aboutsummaryrefslogtreecommitdiff
path: root/libc/test/src/math/powf_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libc/test/src/math/powf_test.cpp')
-rw-r--r--libc/test/src/math/powf_test.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/libc/test/src/math/powf_test.cpp b/libc/test/src/math/powf_test.cpp
index 1d70724..fe8ef4f 100644
--- a/libc/test/src/math/powf_test.cpp
+++ b/libc/test/src/math/powf_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/powf.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 LlvmLibcPowfTest = LIBC_NAMESPACE::testing::FPTest<float>;
using LIBC_NAMESPACE::testing::tlog;
@@ -42,7 +48,7 @@ TEST_F(LlvmLibcPowfTest, TrickyInputs) {
float x = INPUTS[i].x;
float y = INPUTS[i].y;
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Pow, INPUTS[i],
- LIBC_NAMESPACE::powf(x, y), 0.5);
+ LIBC_NAMESPACE::powf(x, y), TOLERANCE + 0.5);
}
}
@@ -88,7 +94,8 @@ TEST_F(LlvmLibcPowfTest, InFloatRange) {
mpfr::BinaryInput<float> inputs{x, y};
if (!TEST_MPFR_MATCH_ROUNDING_SILENTLY(mpfr::Operation::Pow, inputs,
- result, 0.5, rounding_mode)) {
+ result, TOLERANCE + 0.5,
+ rounding_mode)) {
++fails;
while (!TEST_MPFR_MATCH_ROUNDING_SILENTLY(
mpfr::Operation::Pow, inputs, result, tol, rounding_mode)) {