diff options
| author | Florian Mayer <fmayer@google.com> | 2025-10-22 10:55:10 -0700 |
|---|---|---|
| committer | Florian Mayer <fmayer@google.com> | 2025-10-22 10:55:10 -0700 |
| commit | a0abc0af0a0a90878822f8107d70dad6f7cdfc26 (patch) | |
| tree | 3317f49277cc325327cfe3d9a7be4b6e9bacd0f5 /libc/test/src/math/exp_test.cpp | |
| parent | e8230892228fd3b3e543c869f1238fa199d48bc1 (diff) | |
| parent | 735b1ad667ac7373c89ccc0f0e757ef418f8f790 (diff) | |
[𝘀𝗽𝗿] changes introduced through rebaseusers/fmayer/spr/main.wip-smartpointers
Created using spr 1.3.7
[skip ci]
Diffstat (limited to 'libc/test/src/math/exp_test.cpp')
| -rw-r--r-- | libc/test/src/math/exp_test.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libc/test/src/math/exp_test.cpp b/libc/test/src/math/exp_test.cpp index 854bb5155e11..5a785fbaee4f 100644 --- a/libc/test/src/math/exp_test.cpp +++ b/libc/test/src/math/exp_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/exp.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 LlvmLibcExpTest = LIBC_NAMESPACE::testing::FPTest<double>; @@ -52,7 +58,7 @@ TEST_F(LlvmLibcExpTest, TrickyInputs) { for (int i = 0; i < N; ++i) { double x = FPBits(INPUTS[i]).get_val(); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, - LIBC_NAMESPACE::exp(x), 0.5); + LIBC_NAMESPACE::exp(x), TOLERANCE + 0.5); } } @@ -85,7 +91,7 @@ TEST_F(LlvmLibcExpTest, InDoubleRange) { ++count; // ASSERT_MPFR_MATCH(mpfr::Operation::Log, x, result, 0.5); if (!TEST_MPFR_MATCH_ROUNDING_SILENTLY(mpfr::Operation::Exp, x, result, - 0.5, rounding_mode)) { + TOLERANCE + 0.5, rounding_mode)) { ++fails; while (!TEST_MPFR_MATCH_ROUNDING_SILENTLY(mpfr::Operation::Exp, x, result, tol, rounding_mode)) { @@ -99,10 +105,10 @@ TEST_F(LlvmLibcExpTest, InDoubleRange) { } } } - tlog << " Exp failed: " << fails << "/" << count << "/" << cc - << " tests.\n"; - tlog << " Max ULPs is at most: " << static_cast<uint64_t>(tol) << ".\n"; if (fails) { + tlog << " Exp failed: " << fails << "/" << count << "/" << cc + << " tests.\n"; + tlog << " Max ULPs is at most: " << static_cast<uint64_t>(tol) << ".\n"; EXPECT_MPFR_MATCH(mpfr::Operation::Exp, mx, mr, 0.5, rounding_mode); } }; |
