1 #include <stan/math/prim.hpp>
2 #include <gtest/gtest.h>
3 #include <cmath>
4 #include <limits>
5 #include <stdexcept>
6 
TEST(MathFunctions,erf)7 TEST(MathFunctions, erf) {
8   using stan::math::erf;
9   EXPECT_FLOAT_EQ(-0.3286267594591274, erf(-0.3));
10   EXPECT_FLOAT_EQ(0, erf(0));
11   EXPECT_FLOAT_EQ(0.9999939742388482, erf(3.2));
12 }
13 
TEST(MathFunctions,erfOverflow)14 TEST(MathFunctions, erfOverflow) {
15   EXPECT_FLOAT_EQ(-1, erf(-100));
16   EXPECT_FLOAT_EQ(1, erf(100));
17 }
18 
TEST(MathFunctions,erfNan)19 TEST(MathFunctions, erfNan) {
20   double nan = std::numeric_limits<double>::quiet_NaN();
21   EXPECT_TRUE(std::isnan(stan::math::erf(nan)));
22 }
23