[libc-commits] [libc] 6c75240 - [libc][math] Fix broken tests.
Kirill Okhotnikov via libc-commits
libc-commits at lists.llvm.org
Tue Aug 30 13:59:59 PDT 2022
Author: Kirill Okhotnikov
Date: 2022-08-30T22:59:47+02:00
New Revision: 6c75240da0d943c79389e88b33c8cdf6e12d4d23
URL: https://github.com/llvm/llvm-project/commit/6c75240da0d943c79389e88b33c8cdf6e12d4d23
DIFF: https://github.com/llvm/llvm-project/commit/6c75240da0d943c79389e88b33c8cdf6e12d4d23.diff
LOG: [libc][math] Fix broken tests.
Added:
Modified:
libc/test/src/math/explogxf_test.cpp
libc/test/src/math/inv_trigf_utils_test.cpp
Removed:
################################################################################
diff --git a/libc/test/src/math/explogxf_test.cpp b/libc/test/src/math/explogxf_test.cpp
index 599d00580403..cceb3d5158b4 100644
--- a/libc/test/src/math/explogxf_test.cpp
+++ b/libc/test/src/math/explogxf_test.cpp
@@ -21,6 +21,10 @@ DECLARE_SPECIAL_CONSTANTS(float)
constexpr int def_count = 100003;
constexpr float def_prec = 0.500001f;
+auto f_normal = [](float x) -> bool {
+ return !(isnan(x) || isinf(x) || fabs(x) < 2E-38);
+};
+
TEST(LlvmLibcExpxfTest, InFloatRange) {
auto fx = [](float x) -> float {
auto result = __llvm_libc::exp_eval<-1>(x);
@@ -45,11 +49,11 @@ TEST(LlvmLibcExp2xfTest, InFloatRange) {
}
TEST(LlvmLibcLog2xfTest, InFloatRange) {
- CHECK_DATA(0.0f, inf, mpfr::Operation::Log2, __llvm_libc::log2_eval, isnormal,
+ CHECK_DATA(0.0f, inf, mpfr::Operation::Log2, __llvm_libc::log2_eval, f_normal,
def_count, def_prec);
}
TEST(LlvmLibcLogxfTest, InFloatRange) {
- CHECK_DATA(0.0f, inf, mpfr::Operation::Log, __llvm_libc::log_eval, isnormal,
+ CHECK_DATA(0.0f, inf, mpfr::Operation::Log, __llvm_libc::log_eval, f_normal,
def_count, def_prec);
}
diff --git a/libc/test/src/math/inv_trigf_utils_test.cpp b/libc/test/src/math/inv_trigf_utils_test.cpp
index ad2d89c40408..719882386a07 100644
--- a/libc/test/src/math/inv_trigf_utils_test.cpp
+++ b/libc/test/src/math/inv_trigf_utils_test.cpp
@@ -21,12 +21,14 @@ DECLARE_SPECIAL_CONSTANTS(float)
constexpr int def_count = 100003;
constexpr float def_prec = 0.500001f;
+auto f_normal = [](float x) -> bool { return !(isnan(x) || isinf(x)); };
+
TEST(LlvmLibcAtanfPosTest, InFloatRange) {
- CHECK_DATA(0.0f, inf, mpfr::Operation::Atan, __llvm_libc::atan_eval, isfinite,
+ CHECK_DATA(0.0f, inf, mpfr::Operation::Atan, __llvm_libc::atan_eval, f_normal,
def_count, def_prec);
}
TEST(LlvmLibcAtanfNegTest, InFloatRange) {
CHECK_DATA(-0.0f, neg_inf, mpfr::Operation::Atan, __llvm_libc::atan_eval,
- isfinite, def_count, def_prec);
+ f_normal, def_count, def_prec);
}
More information about the libc-commits
mailing list