aboutsummaryrefslogtreecommitdiff
path: root/libc/test/src/math/tanf_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libc/test/src/math/tanf_test.cpp')
-rw-r--r--libc/test/src/math/tanf_test.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/libc/test/src/math/tanf_test.cpp b/libc/test/src/math/tanf_test.cpp
index 2202bd6..b384d8c 100644
--- a/libc/test/src/math/tanf_test.cpp
+++ b/libc/test/src/math/tanf_test.cpp
@@ -9,12 +9,19 @@
#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/macros/optimization.h"
#include "src/math/tanf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "test/src/math/sdcomp26094.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
+#ifdef LIBC_MATH_HAS_SKIP_ACCURATE_PASS
+#define TOLERANCE 1
+#else
+#define TOLERANCE 0
+#endif // LIBC_MATH_HAS_SKIP_ACCURATE_PASS
+
#include "hdr/stdint_proxy.h"
using LlvmLibcTanfTest = LIBC_NAMESPACE::testing::FPTest<float>;
@@ -114,9 +121,9 @@ TEST_F(LlvmLibcTanfTest, SpecificBitPatterns) {
for (int i = 0; i < N; ++i) {
float x = FPBits(INPUTS[i]).get_val();
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tan, x,
- LIBC_NAMESPACE::tanf(x), 0.5);
+ LIBC_NAMESPACE::tanf(x), TOLERANCE + 0.5);
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tan, -x,
- LIBC_NAMESPACE::tanf(-x), 0.5);
+ LIBC_NAMESPACE::tanf(-x), TOLERANCE + 0.5);
}
}