diff options
Diffstat (limited to 'libc/test/src/math/erff_test.cpp')
-rw-r--r-- | libc/test/src/math/erff_test.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libc/test/src/math/erff_test.cpp b/libc/test/src/math/erff_test.cpp index c40aacf..17ff6c4 100644 --- a/libc/test/src/math/erff_test.cpp +++ b/libc/test/src/math/erff_test.cpp @@ -7,13 +7,19 @@ //===----------------------------------------------------------------------===// #include "hdr/math_macros.h" +#include "hdr/stdint_proxy.h" #include "src/__support/FPUtil/FPBits.h" +#include "src/__support/macros/optimization.h" #include "src/math/erff.h" #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include "hdr/stdint_proxy.h" +#ifdef LIBC_MATH_HAS_SKIP_ACCURATE_PASS +#define TOLERANCE 1 +#else +#define TOLERANCE 0 +#endif // LIBC_MATH_HAS_SKIP_ACCURATE_PASS using LlvmLibcErffTest = LIBC_NAMESPACE::testing::FPTest<float>; @@ -37,9 +43,9 @@ TEST_F(LlvmLibcErffTest, TrickyInputs) { for (int i = 0; i < N; ++i) { float x = FPBits(INPUTS[i]).get_val(); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Erf, x, - LIBC_NAMESPACE::erff(x), 0.5); + LIBC_NAMESPACE::erff(x), TOLERANCE + 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Erf, -x, - LIBC_NAMESPACE::erff(-x), 0.5); + LIBC_NAMESPACE::erff(-x), TOLERANCE + 0.5); } } @@ -83,10 +89,10 @@ TEST_F(LlvmLibcErffTest, InFloatRange) { } } } - tlog << " Log failed: " << fails << "/" << count << "/" << cc - << " tests.\n"; - tlog << " Max ULPs is at most: " << static_cast<uint64_t>(tol) << ".\n"; if (fails) { + tlog << " Log failed: " << fails << "/" << count << "/" << cc + << " tests.\n"; + tlog << " Max ULPs is at most: " << static_cast<uint64_t>(tol) << ".\n"; EXPECT_MPFR_MATCH(mpfr::Operation::Erf, mx, mr, 0.5, rounding_mode); } }; |