29 changes: 0 additions & 29 deletions libc/test/src/math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ add_fp_unittest(
HDRS
sdcomp26094.h
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.math.cosf
libc.src.__support.CPP.array
Expand Down Expand Up @@ -39,7 +38,6 @@ add_fp_unittest(
HDRS
sdcomp26094.h
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.math.sinf
libc.src.__support.CPP.array
Expand Down Expand Up @@ -68,7 +66,6 @@ add_fp_unittest(
HDRS
sdcomp26094.h
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.math.sincosf
libc.src.__support.CPP.array
Expand All @@ -85,7 +82,6 @@ add_fp_unittest(
HDRS
sdcomp26094.h
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.math.tanf
libc.src.__support.CPP.array
Expand Down Expand Up @@ -327,7 +323,6 @@ add_fp_unittest(
HDRS
RoundToIntegerTest.h
DEPENDS
libc.include.errno
libc.include.math
libc.src.errno.errno
libc.src.fenv.feclearexcept
Expand All @@ -347,7 +342,6 @@ add_fp_unittest(
HDRS
RoundToIntegerTest.h
DEPENDS
libc.include.errno
libc.include.math
libc.src.errno.errno
libc.src.fenv.feclearexcept
Expand All @@ -367,7 +361,6 @@ add_fp_unittest(
HDRS
RoundToIntegerTest.h
DEPENDS
libc.include.errno
libc.include.math
libc.src.errno.errno
libc.src.fenv.feclearexcept
Expand All @@ -387,7 +380,6 @@ add_fp_unittest(
HDRS
RoundToIntegerTest.h
DEPENDS
libc.include.errno
libc.include.math
libc.src.errno.errno
libc.src.fenv.feclearexcept
Expand All @@ -407,7 +399,6 @@ add_fp_unittest(
HDRS
RoundToIntegerTest.h
DEPENDS
libc.include.errno
libc.include.math
libc.src.errno.errno
libc.src.fenv.feclearexcept
Expand All @@ -427,7 +418,6 @@ add_fp_unittest(
HDRS
RoundToIntegerTest.h
DEPENDS
libc.include.errno
libc.include.math
libc.src.errno.errno
libc.src.fenv.feclearexcept
Expand Down Expand Up @@ -589,7 +579,6 @@ add_fp_unittest(
SRCS
expf_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.include.math
libc.src.math.expf
Expand All @@ -604,7 +593,6 @@ add_fp_unittest(
SRCS
exp2f_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.include.math
libc.src.math.exp2f
Expand All @@ -619,7 +607,6 @@ add_fp_unittest(
SRCS
exp10f_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.include.math
libc.src.math.exp10f
Expand Down Expand Up @@ -1268,7 +1255,6 @@ add_fp_unittest(
SRCS
expm1f_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.include.math
libc.src.math.expm1f
Expand All @@ -1295,7 +1281,6 @@ add_fp_unittest(
SRCS
logf_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.include.math
libc.src.math.logf
Expand All @@ -1310,7 +1295,6 @@ add_fp_unittest(
SRCS
log2f_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.include.math
libc.src.math.log2f
Expand All @@ -1325,7 +1309,6 @@ add_fp_unittest(
SRCS
log10_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.include.math
libc.src.math.log10
Expand All @@ -1342,7 +1325,6 @@ add_fp_unittest(
SRCS
log10f_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.include.math
libc.src.math.log10f
Expand All @@ -1357,7 +1339,6 @@ add_fp_unittest(
SRCS
log1pf_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.include.math
libc.src.math.log1pf
Expand Down Expand Up @@ -1419,7 +1400,6 @@ add_fp_unittest(
HDRS
sdcomp26094.h
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.math.coshf
libc.src.__support.CPP.array
Expand All @@ -1436,7 +1416,6 @@ add_fp_unittest(
HDRS
sdcomp26094.h
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.math.sinhf
libc.src.__support.CPP.array
Expand All @@ -1463,7 +1442,6 @@ add_fp_unittest(
SRCS
atanhf_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.math.atanhf
libc.src.__support.FPUtil.fp_bits
Expand All @@ -1477,7 +1455,6 @@ add_fp_unittest(
SRCS
asinhf_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.math.asinhf
libc.src.__support.FPUtil.fp_bits
Expand All @@ -1491,7 +1468,6 @@ add_fp_unittest(
SRCS
acoshf_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.math.acoshf
libc.src.__support.FPUtil.fp_bits
Expand All @@ -1505,7 +1481,6 @@ add_fp_unittest(
SRCS
asinf_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.math.asinf
libc.src.__support.FPUtil.fp_bits
Expand All @@ -1519,7 +1494,6 @@ add_fp_unittest(
SRCS
asin_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.math.asin
)
Expand All @@ -1532,7 +1506,6 @@ add_fp_unittest(
SRCS
acosf_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.math.acosf
libc.src.__support.FPUtil.fp_bits
Expand All @@ -1546,7 +1519,6 @@ add_fp_unittest(
SRCS
atanf_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.math.atanf
libc.src.__support.FPUtil.fp_bits
Expand Down Expand Up @@ -1574,7 +1546,6 @@ add_fp_unittest(
SRCS
pow_test.cpp
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.math.pow
)
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/RoundToIntegerTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {

void test_one_input(RoundToIntegerFunc func, F input, I expected,
bool expectError) {
errno = 0;
libc_errno = 0;
__llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);

ASSERT_EQ(func(input), expected);
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/acosf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/acosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -23,7 +24,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcAcosfTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::acosf(aNaN));
EXPECT_MATH_ERRNO(0);
Expand Down
7 changes: 4 additions & 3 deletions libc/test/src/math/acoshf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/acoshf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -23,13 +24,13 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcAcoshfTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::acoshf(aNaN));
EXPECT_MATH_ERRNO(0);

EXPECT_FP_EQ(aNaN, __llvm_libc::acoshf(0.0f));
EXPECT_MATH_ERRNO(0);
EXPECT_MATH_ERRNO(EDOM);

EXPECT_FP_EQ(0.0f, __llvm_libc::acoshf(1.0f));
EXPECT_MATH_ERRNO(0);
Expand All @@ -38,7 +39,7 @@ TEST(LlvmLibcAcoshfTest, SpecialNumbers) {
EXPECT_MATH_ERRNO(0);

EXPECT_FP_EQ(aNaN, __llvm_libc::acoshf(neg_inf));
EXPECT_MATH_ERRNO(0);
EXPECT_MATH_ERRNO(EDOM);
}

TEST(LlvmLibcAcoshfTest, InFloatRange) {
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/asin_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "src/errno/libc_errno.h"
#include "src/math/asin.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -22,7 +23,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(double)

TEST(LlvmLibcAsinTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::asin(aNaN));
EXPECT_MATH_ERRNO(0);
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/asinf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/asinf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -24,7 +25,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcAsinfTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::asinf(aNaN));
EXPECT_MATH_ERRNO(0);
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/asinhf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/asinhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -23,7 +24,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcAsinhfTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::asinhf(aNaN));
EXPECT_MATH_ERRNO(0);
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/atanf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/atanf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -25,7 +26,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcAtanfTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;
__llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
EXPECT_FP_EQ(aNaN, __llvm_libc::atanf(aNaN));
EXPECT_FP_EXCEPTION(0);
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/atanhf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/atanhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -23,7 +24,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcAtanhfTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;
__llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
EXPECT_FP_EQ(aNaN, __llvm_libc::atanhf(aNaN));
EXPECT_FP_EXCEPTION(0);
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/cosf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/cosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -25,7 +26,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcCosfTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::cosf(aNaN));
EXPECT_MATH_ERRNO(0);
Expand Down
5 changes: 3 additions & 2 deletions libc/test/src/math/coshf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "src/__support/CPP/array.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/coshf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -24,7 +25,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcCoshfTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::coshf(aNaN));
EXPECT_MATH_ERRNO(0);
Expand All @@ -43,7 +44,7 @@ TEST(LlvmLibcCoshfTest, SpecialNumbers) {
}

TEST(LlvmLibcCoshfTest, Overflow) {
errno = 0;
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, __llvm_libc::coshf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
Expand Down
11 changes: 6 additions & 5 deletions libc/test/src/math/exp10f_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/exp10f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -21,7 +22,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcExp10fTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::exp10f(aNaN));
EXPECT_MATH_ERRNO(0);
Expand All @@ -40,7 +41,7 @@ TEST(LlvmLibcExp10fTest, SpecialNumbers) {
}

TEST(LlvmLibcExp10fTest, Overflow) {
errno = 0;
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, __llvm_libc::exp10f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
Expand All @@ -55,7 +56,7 @@ TEST(LlvmLibcExp10fTest, Overflow) {
}

TEST(LlvmLibcExp10fTest, Underflow) {
errno = 0;
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
0.0f, __llvm_libc::exp10f(float(FPBits(0xff7fffffU))), FE_UNDERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
Expand Down Expand Up @@ -96,7 +97,7 @@ TEST(LlvmLibcExp10fTest, TrickyInputs) {
0x41200000, // x = 10.0f
};
for (int i = 0; i < N; ++i) {
errno = 0;
libc_errno = 0;
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x,
__llvm_libc::exp10f(x), 0.5);
Expand All @@ -112,7 +113,7 @@ TEST(LlvmLibcExp10fTest, InFloatRange) {
float x = float(FPBits(v));
if (isnan(x) || isinf(x))
continue;
errno = 0;
libc_errno = 0;
float result = __llvm_libc::exp10f(x);

// If the computation resulted in an error or did not produce valid result
Expand Down
11 changes: 6 additions & 5 deletions libc/test/src/math/exp2f_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#include "src/errno/libc_errno.h"
#include "src/math/exp2f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -22,7 +23,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcExp2fTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::exp2f(aNaN));
EXPECT_MATH_ERRNO(0);
Expand All @@ -41,7 +42,7 @@ TEST(LlvmLibcExp2fTest, SpecialNumbers) {
}

TEST(LlvmLibcExp2fTest, Overflow) {
errno = 0;
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, __llvm_libc::exp2f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
Expand Down Expand Up @@ -72,7 +73,7 @@ TEST(LlvmLibcExp2fTest, TrickyInputs) {
0xc3150000U, /*-0x1.2ap+7f*/
};
for (int i = 0; i < N; ++i) {
errno = 0;
libc_errno = 0;
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x,
__llvm_libc::exp2f(x), 0.5);
Expand All @@ -81,7 +82,7 @@ TEST(LlvmLibcExp2fTest, TrickyInputs) {
}

TEST(LlvmLibcExp2fTest, Underflow) {
errno = 0;
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
0.0f, __llvm_libc::exp2f(float(FPBits(0xff7fffffU))), FE_UNDERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
Expand Down Expand Up @@ -109,7 +110,7 @@ TEST(LlvmLibcExp2fTest, InFloatRange) {
float x = float(FPBits(v));
if (isnan(x) || isinf(x))
continue;
errno = 0;
libc_errno = 0;
float result = __llvm_libc::exp2f(x);

// If the computation resulted in an error or did not produce valid result
Expand Down
11 changes: 6 additions & 5 deletions libc/test/src/math/expf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/expf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -21,7 +22,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcExpfTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::expf(aNaN));
EXPECT_MATH_ERRNO(0);
Expand All @@ -40,7 +41,7 @@ TEST(LlvmLibcExpfTest, SpecialNumbers) {
}

TEST(LlvmLibcExpfTest, Overflow) {
errno = 0;
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, __llvm_libc::expf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
Expand All @@ -55,7 +56,7 @@ TEST(LlvmLibcExpfTest, Overflow) {
}

TEST(LlvmLibcExpfTest, Underflow) {
errno = 0;
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
0.0f, __llvm_libc::expf(float(FPBits(0xff7fffffU))), FE_UNDERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
Expand All @@ -76,7 +77,7 @@ TEST(LlvmLibcExpfTest, Underflow) {
TEST(LlvmLibcExpfTest, Borderline) {
float x;

errno = 0;
libc_errno = 0;
x = float(FPBits(0x42affff8U));
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x),
0.5);
Expand Down Expand Up @@ -110,7 +111,7 @@ TEST(LlvmLibcExpfTest, InFloatRange) {
float x = float(FPBits(v));
if (isnan(x) || isinf(x))
continue;
errno = 0;
libc_errno = 0;
float result = __llvm_libc::expf(x);

// If the computation resulted in an error or did not produce valid result
Expand Down
11 changes: 6 additions & 5 deletions libc/test/src/math/expm1f_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/expm1f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -21,7 +22,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcExpm1fTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::expm1f(aNaN));
EXPECT_MATH_ERRNO(0);
Expand All @@ -40,7 +41,7 @@ TEST(LlvmLibcExpm1fTest, SpecialNumbers) {
}

TEST(LlvmLibcExpm1fTest, Overflow) {
errno = 0;
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, __llvm_libc::expm1f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
Expand All @@ -55,7 +56,7 @@ TEST(LlvmLibcExpm1fTest, Overflow) {
}

TEST(LlvmLibcExpm1fTest, Underflow) {
errno = 0;
libc_errno = 0;
EXPECT_FP_EQ(-1.0f, __llvm_libc::expm1f(float(FPBits(0xff7fffffU))));

float x = float(FPBits(0xc2cffff8U));
Expand All @@ -70,7 +71,7 @@ TEST(LlvmLibcExpm1fTest, Underflow) {
TEST(LlvmLibcExpm1fTest, Borderline) {
float x;

errno = 0;
libc_errno = 0;
x = float(FPBits(0x42affff8U));
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x,
__llvm_libc::expm1f(x), 0.5);
Expand Down Expand Up @@ -119,7 +120,7 @@ TEST(LlvmLibcExpm1fTest, InFloatRange) {
float x = float(FPBits(v));
if (isnan(x) || isinf(x))
continue;
errno = 0;
libc_errno = 0;
float result = __llvm_libc::expm1f(x);

// If the computation resulted in an error or did not produce valid result
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/log10_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log10.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand Down Expand Up @@ -84,7 +85,7 @@ TEST(LlvmLibcLog10Test, InDoubleRange) {
double x = FPBits(v).get_val();
if (isnan(x) || isinf(x) || x < 0.0)
continue;
errno = 0;
libc_errno = 0;
double result = __llvm_libc::log10(x);
++cc;
if (isnan(result))
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/log1pf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log1pf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand Down Expand Up @@ -75,7 +76,7 @@ TEST(LlvmLibclog1pfTest, InFloatRange) {
float x = float(FPBits(v));
if (isnan(x) || isinf(x))
continue;
errno = 0;
libc_errno = 0;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x,
__llvm_libc::log1pf(x), 0.5);
}
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/log2f_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log2f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand Down Expand Up @@ -50,7 +51,7 @@ TEST(LlvmLibcLog2fTest, InFloatRange) {
float x = float(FPBits(v));
if (isnan(x) || isinf(x))
continue;
errno = 0;
libc_errno = 0;
float result = __llvm_libc::log2f(x);
// If the computation resulted in an error or did not produce valid result
// in the single-precision floating point range, then ignore comparing with
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/pow_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "src/errno/libc_errno.h"
#include "src/math/pow.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -22,7 +23,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(double)

TEST(LlvmLibcAsinTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::pow(aNaN, aNaN));
EXPECT_MATH_ERRNO(0);
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/sincosf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/sincosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -25,7 +26,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcSinCosfTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;
float sin, cos;

__llvm_libc::sincosf(aNaN, &sin, &cos);
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/sinf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/sinf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -25,7 +26,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcSinfTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(aNaN));
EXPECT_MATH_ERRNO(0);
Expand Down
5 changes: 3 additions & 2 deletions libc/test/src/math/sinhf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "src/__support/CPP/array.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/sinhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -24,7 +25,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcSinhfTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::sinhf(aNaN));
EXPECT_MATH_ERRNO(0);
Expand Down Expand Up @@ -67,7 +68,7 @@ TEST(LlvmLibcSinhfTest, SmallValues) {
}

TEST(LlvmLibcSinhfTest, Overflow) {
errno = 0;
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, __llvm_libc::sinhf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/tanf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/tanf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -25,7 +26,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcTanfTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(aNaN));
EXPECT_MATH_ERRNO(0);
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/math/tanhf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/tanhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -23,7 +24,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)

TEST(LlvmLibcTanhfTest, SpecialNumbers) {
errno = 0;
libc_errno = 0;

EXPECT_FP_EQ(aNaN, __llvm_libc::tanhf(aNaN));
EXPECT_MATH_ERRNO(0);
Expand Down