[libc][math] Fix broken tests.

This commit is contained in:
Kirill Okhotnikov 2022-08-30 22:59:00 +02:00
parent 0fd9580865
commit 6c75240da0
2 changed files with 10 additions and 4 deletions

View File

@ -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);
}

View File

@ -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);
}