[libc-commits] [libc] [libc][math] Add tolerance for powf smoke test when skipping accurate pass. (PR #229656)
via libc-commits
libc-commits at lists.llvm.org
Tue Oct 6 21:50:51 PDT 2026
https://github.com/lntue created https://github.com/llvm/llvm-project/pull/229656
None
>From 021b4a3ea64fa5888af31fdbda1f07c0b29c03c6 Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue at google.com>
Date: Wed, 7 Oct 2026 00:49:17 -0400
Subject: [PATCH] [libc][math] Add tolerance for powf smoke test when skipping
accurate pass.
---
libc/test/src/math/smoke/powf_test.cpp | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/libc/test/src/math/smoke/powf_test.cpp b/libc/test/src/math/smoke/powf_test.cpp
index bda8d34f7c5f1..46d4f1b712094 100644
--- a/libc/test/src/math/smoke/powf_test.cpp
+++ b/libc/test/src/math/smoke/powf_test.cpp
@@ -21,6 +21,12 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
+#ifdef LIBC_MATH_HAS_SKIP_ACCURATE_PASS
+#define TOLERANCE 1
+#else
+#define TOLERANCE 0
+#endif // LIBC_MATH_HAS_SKIP_ACCURATE_PASS
+
using LIBC_NAMESPACE::fputil::testing::ForceRoundingMode;
using LIBC_NAMESPACE::fputil::testing::RoundingMode;
@@ -295,8 +301,7 @@ class PowfTest : public LIBC_NAMESPACE::testing::FPTest<float> {
LIST_POWF_FTZ_DAZ_TESTS(suffix, func) \
static_assert(true, "Require semicolon.")
-LIST_POWF_TESTS(Default, LIBC_NAMESPACE::powf, /*tolerance=*/0);
-LIST_POWF_TESTS(DoubleEval, LIBC_NAMESPACE::math::double_eval::powf,
- /*tolerance=*/0);
+LIST_POWF_TESTS(Default, LIBC_NAMESPACE::powf, TOLERANCE);
+LIST_POWF_TESTS(DoubleEval, LIBC_NAMESPACE::math::double_eval::powf, TOLERANCE);
LIST_POWF_TESTS(FloatEval, LIBC_NAMESPACE::math::float_eval::powf,
/*tolerance=*/1);
More information about the libc-commits
mailing list