From f66cf13d5d0bc4099d452088c03fd6705aae2bc7 Mon Sep 17 00:00:00 2001 From: Siva Chandra Reddy Date: Tue, 15 Dec 2020 22:23:22 -0800 Subject: [PATCH] [libc][NFC] Rename global `nan` in tests to `aNaN`. The name `nan` conflicts with the function `nan` defined declared in math.h. --- libc/test/src/math/ceil_test.cpp | 4 ++-- libc/test/src/math/ceilf_test.cpp | 4 ++-- libc/test/src/math/ceill_test.cpp | 4 ++-- libc/test/src/math/copysign_test.cpp | 4 ++-- libc/test/src/math/copysignf_test.cpp | 4 ++-- libc/test/src/math/copysignl_test.cpp | 4 ++-- libc/test/src/math/fabs_test.cpp | 2 +- libc/test/src/math/fabsf_test.cpp | 2 +- libc/test/src/math/fabsl_test.cpp | 2 +- libc/test/src/math/floor_test.cpp | 4 ++-- libc/test/src/math/floorf_test.cpp | 4 ++-- libc/test/src/math/floorl_test.cpp | 4 ++-- libc/test/src/math/fmax_test.cpp | 14 +++++++------- libc/test/src/math/fmaxf_test.cpp | 14 +++++++------- libc/test/src/math/fmaxl_test.cpp | 14 +++++++------- libc/test/src/math/fmin_test.cpp | 14 +++++++------- libc/test/src/math/fminf_test.cpp | 14 +++++++------- libc/test/src/math/fminl_test.cpp | 14 +++++++------- libc/test/src/math/round_test.cpp | 4 ++-- libc/test/src/math/roundf_test.cpp | 4 ++-- libc/test/src/math/roundl_test.cpp | 4 ++-- libc/test/src/math/sqrt_test.cpp | 6 +++--- libc/test/src/math/sqrtf_test.cpp | 6 +++--- libc/test/src/math/sqrtl_test.cpp | 6 +++--- libc/test/src/math/trunc_test.cpp | 4 ++-- libc/test/src/math/truncf_test.cpp | 4 ++-- libc/test/src/math/truncl_test.cpp | 4 ++-- libc/utils/FPUtil/TestHelpers.h | 2 +- 28 files changed, 85 insertions(+), 85 deletions(-) diff --git a/libc/test/src/math/ceil_test.cpp b/libc/test/src/math/ceil_test.cpp index 0e17b0a..1537227 100644 --- a/libc/test/src/math/ceil_test.cpp +++ b/libc/test/src/math/ceil_test.cpp @@ -26,8 +26,8 @@ TEST(CeilTest, SpecialNumbers) { EXPECT_FP_EQ(inf, __llvm_libc::ceil(inf)); EXPECT_FP_EQ(negInf, __llvm_libc::ceil(negInf)); - ASSERT_NE(isnan(nan), 0); - ASSERT_NE(isnan(__llvm_libc::ceil(nan)), 0); + ASSERT_NE(isnan(aNaN), 0); + ASSERT_NE(isnan(__llvm_libc::ceil(aNaN)), 0); } TEST(CeilTest, RoundedNumbers) { diff --git a/libc/test/src/math/ceilf_test.cpp b/libc/test/src/math/ceilf_test.cpp index 3d7db68..aa3ea73 100644 --- a/libc/test/src/math/ceilf_test.cpp +++ b/libc/test/src/math/ceilf_test.cpp @@ -26,8 +26,8 @@ TEST(CeilfTest, SpecialNumbers) { EXPECT_FP_EQ(inf, __llvm_libc::ceilf(inf)); EXPECT_FP_EQ(negInf, __llvm_libc::ceilf(negInf)); - ASSERT_NE(isnan(nan), 0); - ASSERT_NE(isnan(__llvm_libc::ceilf(nan)), 0); + ASSERT_NE(isnan(aNaN), 0); + ASSERT_NE(isnan(__llvm_libc::ceilf(aNaN)), 0); } TEST(CeilfTest, RoundedNumbers) { diff --git a/libc/test/src/math/ceill_test.cpp b/libc/test/src/math/ceill_test.cpp index 950a976..b33d317 100644 --- a/libc/test/src/math/ceill_test.cpp +++ b/libc/test/src/math/ceill_test.cpp @@ -26,8 +26,8 @@ TEST(CeillTest, SpecialNumbers) { EXPECT_FP_EQ(inf, __llvm_libc::ceill(inf)); EXPECT_FP_EQ(negInf, __llvm_libc::ceill(negInf)); - ASSERT_NE(isnan(nan), 0); - ASSERT_NE(isnan(__llvm_libc::ceill(nan)), 0); + ASSERT_NE(isnan(aNaN), 0); + ASSERT_NE(isnan(__llvm_libc::ceill(aNaN)), 0); } TEST(CeillTest, RoundedNumbers) { diff --git a/libc/test/src/math/copysign_test.cpp b/libc/test/src/math/copysign_test.cpp index 09067fa..7ab7ccf 100644 --- a/libc/test/src/math/copysign_test.cpp +++ b/libc/test/src/math/copysign_test.cpp @@ -17,8 +17,8 @@ using FPBits = __llvm_libc::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(double) TEST(CopySignTest, SpecialNumbers) { - EXPECT_FP_EQ(nan, __llvm_libc::copysign(nan, -1.0)); - EXPECT_FP_EQ(nan, __llvm_libc::copysign(nan, 1.0)); + EXPECT_FP_EQ(aNaN, __llvm_libc::copysign(aNaN, -1.0)); + EXPECT_FP_EQ(aNaN, __llvm_libc::copysign(aNaN, 1.0)); EXPECT_FP_EQ(negInf, __llvm_libc::copysign(inf, -1.0)); EXPECT_FP_EQ(inf, __llvm_libc::copysign(negInf, 1.0)); diff --git a/libc/test/src/math/copysignf_test.cpp b/libc/test/src/math/copysignf_test.cpp index e430550..72082ca 100644 --- a/libc/test/src/math/copysignf_test.cpp +++ b/libc/test/src/math/copysignf_test.cpp @@ -17,8 +17,8 @@ using FPBits = __llvm_libc::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(CopySinfTest, SpecialNumbers) { - EXPECT_FP_EQ(nan, __llvm_libc::copysignf(nan, -1.0)); - EXPECT_FP_EQ(nan, __llvm_libc::copysignf(nan, 1.0)); + EXPECT_FP_EQ(aNaN, __llvm_libc::copysignf(aNaN, -1.0)); + EXPECT_FP_EQ(aNaN, __llvm_libc::copysignf(aNaN, 1.0)); EXPECT_FP_EQ(negInf, __llvm_libc::copysignf(inf, -1.0)); EXPECT_FP_EQ(inf, __llvm_libc::copysignf(negInf, 1.0)); diff --git a/libc/test/src/math/copysignl_test.cpp b/libc/test/src/math/copysignl_test.cpp index 47f439f..69daa03 100644 --- a/libc/test/src/math/copysignl_test.cpp +++ b/libc/test/src/math/copysignl_test.cpp @@ -17,8 +17,8 @@ using FPBits = __llvm_libc::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(long double) TEST(CopySinlTest, SpecialNumbers) { - EXPECT_FP_EQ(nan, __llvm_libc::copysignl(nan, -1.0)); - EXPECT_FP_EQ(nan, __llvm_libc::copysignl(nan, 1.0)); + EXPECT_FP_EQ(aNaN, __llvm_libc::copysignl(aNaN, -1.0)); + EXPECT_FP_EQ(aNaN, __llvm_libc::copysignl(aNaN, 1.0)); EXPECT_FP_EQ(negInf, __llvm_libc::copysignl(inf, -1.0)); EXPECT_FP_EQ(inf, __llvm_libc::copysignl(negInf, 1.0)); diff --git a/libc/test/src/math/fabs_test.cpp b/libc/test/src/math/fabs_test.cpp index 0e1dc48..91d37e3 100644 --- a/libc/test/src/math/fabs_test.cpp +++ b/libc/test/src/math/fabs_test.cpp @@ -20,7 +20,7 @@ DECLARE_SPECIAL_CONSTANTS(double) namespace mpfr = __llvm_libc::testing::mpfr; TEST(FabsTest, SpecialNumbers) { - EXPECT_FP_EQ(nan, __llvm_libc::fabs(nan)); + EXPECT_FP_EQ(aNaN, __llvm_libc::fabs(aNaN)); EXPECT_FP_EQ(inf, __llvm_libc::fabs(inf)); EXPECT_FP_EQ(inf, __llvm_libc::fabs(negInf)); diff --git a/libc/test/src/math/fabsf_test.cpp b/libc/test/src/math/fabsf_test.cpp index 256748c..fc09259 100644 --- a/libc/test/src/math/fabsf_test.cpp +++ b/libc/test/src/math/fabsf_test.cpp @@ -20,7 +20,7 @@ DECLARE_SPECIAL_CONSTANTS(float) namespace mpfr = __llvm_libc::testing::mpfr; TEST(FabsfTest, SpecialNumbers) { - EXPECT_FP_EQ(nan, __llvm_libc::fabsf(nan)); + EXPECT_FP_EQ(aNaN, __llvm_libc::fabsf(aNaN)); EXPECT_FP_EQ(inf, __llvm_libc::fabsf(inf)); EXPECT_FP_EQ(inf, __llvm_libc::fabsf(negInf)); diff --git a/libc/test/src/math/fabsl_test.cpp b/libc/test/src/math/fabsl_test.cpp index fd3a882..1a0cb9d 100644 --- a/libc/test/src/math/fabsl_test.cpp +++ b/libc/test/src/math/fabsl_test.cpp @@ -20,7 +20,7 @@ DECLARE_SPECIAL_CONSTANTS(long double) namespace mpfr = __llvm_libc::testing::mpfr; TEST(FabslTest, SpecialNumbers) { - EXPECT_FP_EQ(nan, __llvm_libc::fabsl(nan)); + EXPECT_FP_EQ(aNaN, __llvm_libc::fabsl(aNaN)); EXPECT_FP_EQ(inf, __llvm_libc::fabsl(inf)); EXPECT_FP_EQ(inf, __llvm_libc::fabsl(negInf)); diff --git a/libc/test/src/math/floor_test.cpp b/libc/test/src/math/floor_test.cpp index 588b2a3..35f107a 100644 --- a/libc/test/src/math/floor_test.cpp +++ b/libc/test/src/math/floor_test.cpp @@ -26,8 +26,8 @@ TEST(FloorTest, SpecialNumbers) { EXPECT_FP_EQ(inf, __llvm_libc::floor(inf)); EXPECT_FP_EQ(negInf, __llvm_libc::floor(negInf)); - ASSERT_NE(isnan(nan), 0); - ASSERT_NE(isnan(__llvm_libc::floor(nan)), 0); + ASSERT_NE(isnan(aNaN), 0); + ASSERT_NE(isnan(__llvm_libc::floor(aNaN)), 0); } TEST(FloorTest, RoundedNumbers) { diff --git a/libc/test/src/math/floorf_test.cpp b/libc/test/src/math/floorf_test.cpp index 5a8e8cf..e6bc974 100644 --- a/libc/test/src/math/floorf_test.cpp +++ b/libc/test/src/math/floorf_test.cpp @@ -26,8 +26,8 @@ TEST(FloorfTest, SpecialNumbers) { EXPECT_FP_EQ(inf, __llvm_libc::floorf(inf)); EXPECT_FP_EQ(negInf, __llvm_libc::floorf(negInf)); - ASSERT_NE(isnan(nan), 0); - ASSERT_NE(isnan(__llvm_libc::floorf(nan)), 0); + ASSERT_NE(isnan(aNaN), 0); + ASSERT_NE(isnan(__llvm_libc::floorf(aNaN)), 0); } TEST(FloorfTest, RoundedNumbers) { diff --git a/libc/test/src/math/floorl_test.cpp b/libc/test/src/math/floorl_test.cpp index 3ab5d5f..cad5c70 100644 --- a/libc/test/src/math/floorl_test.cpp +++ b/libc/test/src/math/floorl_test.cpp @@ -26,8 +26,8 @@ TEST(FloorlTest, SpecialNumbers) { EXPECT_FP_EQ(inf, __llvm_libc::floorl(inf)); EXPECT_FP_EQ(negInf, __llvm_libc::floorl(negInf)); - ASSERT_NE(isnan(nan), 0); - ASSERT_NE(isnan(__llvm_libc::floorl(nan)), 0); + ASSERT_NE(isnan(aNaN), 0); + ASSERT_NE(isnan(__llvm_libc::floorl(aNaN)), 0); } TEST(FloorlTest, RoundedNumbers) { diff --git a/libc/test/src/math/fmax_test.cpp b/libc/test/src/math/fmax_test.cpp index 1114307..b84db30 100644 --- a/libc/test/src/math/fmax_test.cpp +++ b/libc/test/src/math/fmax_test.cpp @@ -17,13 +17,13 @@ using FPBits = __llvm_libc::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(double) TEST(FmaxTest, NaNArg) { - EXPECT_FP_EQ(inf, __llvm_libc::fmax(nan, inf)); - EXPECT_FP_EQ(negInf, __llvm_libc::fmax(negInf, nan)); - EXPECT_FP_EQ(0.0, __llvm_libc::fmax(nan, 0.0)); - EXPECT_FP_EQ(-0.0, __llvm_libc::fmax(-0.0, nan)); - EXPECT_FP_EQ(-1.2345, __llvm_libc::fmax(nan, -1.2345)); - EXPECT_FP_EQ(1.2345, __llvm_libc::fmax(1.2345, nan)); - EXPECT_NE(isnan(__llvm_libc::fmax(nan, nan)), 0); + EXPECT_FP_EQ(inf, __llvm_libc::fmax(aNaN, inf)); + EXPECT_FP_EQ(negInf, __llvm_libc::fmax(negInf, aNaN)); + EXPECT_FP_EQ(0.0, __llvm_libc::fmax(aNaN, 0.0)); + EXPECT_FP_EQ(-0.0, __llvm_libc::fmax(-0.0, aNaN)); + EXPECT_FP_EQ(-1.2345, __llvm_libc::fmax(aNaN, -1.2345)); + EXPECT_FP_EQ(1.2345, __llvm_libc::fmax(1.2345, aNaN)); + EXPECT_NE(isnan(__llvm_libc::fmax(aNaN, aNaN)), 0); } TEST(FmaxTest, InfArg) { diff --git a/libc/test/src/math/fmaxf_test.cpp b/libc/test/src/math/fmaxf_test.cpp index 3e81c99..7d6661c 100644 --- a/libc/test/src/math/fmaxf_test.cpp +++ b/libc/test/src/math/fmaxf_test.cpp @@ -17,13 +17,13 @@ using FPBits = __llvm_libc::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(FmaxfTest, NaNArg) { - EXPECT_FP_EQ(inf, __llvm_libc::fmaxf(nan, inf)); - EXPECT_FP_EQ(negInf, __llvm_libc::fmaxf(negInf, nan)); - EXPECT_FP_EQ(0.0f, __llvm_libc::fmaxf(nan, 0.0f)); - EXPECT_FP_EQ(-0.0f, __llvm_libc::fmaxf(-0.0f, nan)); - EXPECT_FP_EQ(-1.2345f, __llvm_libc::fmaxf(nan, -1.2345f)); - EXPECT_FP_EQ(1.2345f, __llvm_libc::fmaxf(1.2345f, nan)); - EXPECT_NE(isnan(__llvm_libc::fmaxf(nan, nan)), 0); + EXPECT_FP_EQ(inf, __llvm_libc::fmaxf(aNaN, inf)); + EXPECT_FP_EQ(negInf, __llvm_libc::fmaxf(negInf, aNaN)); + EXPECT_FP_EQ(0.0f, __llvm_libc::fmaxf(aNaN, 0.0f)); + EXPECT_FP_EQ(-0.0f, __llvm_libc::fmaxf(-0.0f, aNaN)); + EXPECT_FP_EQ(-1.2345f, __llvm_libc::fmaxf(aNaN, -1.2345f)); + EXPECT_FP_EQ(1.2345f, __llvm_libc::fmaxf(1.2345f, aNaN)); + EXPECT_NE(isnan(__llvm_libc::fmaxf(aNaN, aNaN)), 0); } TEST(FmaxfTest, InfArg) { diff --git a/libc/test/src/math/fmaxl_test.cpp b/libc/test/src/math/fmaxl_test.cpp index ce48b5d..72f7636 100644 --- a/libc/test/src/math/fmaxl_test.cpp +++ b/libc/test/src/math/fmaxl_test.cpp @@ -17,13 +17,13 @@ using FPBits = __llvm_libc::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(long double) TEST(FmaxlTest, NaNArg) { - EXPECT_FP_EQ(inf, __llvm_libc::fmaxl(nan, inf)); - EXPECT_FP_EQ(negInf, __llvm_libc::fmaxl(negInf, nan)); - EXPECT_FP_EQ(0.0L, __llvm_libc::fmaxl(nan, 0.0L)); - EXPECT_FP_EQ(-0.0L, __llvm_libc::fmaxl(-0.0L, nan)); - EXPECT_FP_EQ(-1.2345L, __llvm_libc::fmaxl(nan, -1.2345L)); - EXPECT_FP_EQ(1.2345L, __llvm_libc::fmaxl(1.2345L, nan)); - EXPECT_NE(isnan(__llvm_libc::fmaxl(nan, nan)), 0); + EXPECT_FP_EQ(inf, __llvm_libc::fmaxl(aNaN, inf)); + EXPECT_FP_EQ(negInf, __llvm_libc::fmaxl(negInf, aNaN)); + EXPECT_FP_EQ(0.0L, __llvm_libc::fmaxl(aNaN, 0.0L)); + EXPECT_FP_EQ(-0.0L, __llvm_libc::fmaxl(-0.0L, aNaN)); + EXPECT_FP_EQ(-1.2345L, __llvm_libc::fmaxl(aNaN, -1.2345L)); + EXPECT_FP_EQ(1.2345L, __llvm_libc::fmaxl(1.2345L, aNaN)); + EXPECT_NE(isnan(__llvm_libc::fmaxl(aNaN, aNaN)), 0); } TEST(FmaxlTest, InfArg) { diff --git a/libc/test/src/math/fmin_test.cpp b/libc/test/src/math/fmin_test.cpp index 89a25be..5deaa85 100644 --- a/libc/test/src/math/fmin_test.cpp +++ b/libc/test/src/math/fmin_test.cpp @@ -17,13 +17,13 @@ using FPBits = __llvm_libc::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(double) TEST(FminTest, NaNArg) { - EXPECT_FP_EQ(inf, __llvm_libc::fmin(nan, inf)); - EXPECT_FP_EQ(negInf, __llvm_libc::fmin(negInf, nan)); - EXPECT_FP_EQ(0.0, __llvm_libc::fmin(nan, 0.0)); - EXPECT_FP_EQ(-0.0, __llvm_libc::fmin(-0.0, nan)); - EXPECT_FP_EQ(-1.2345, __llvm_libc::fmin(nan, -1.2345)); - EXPECT_FP_EQ(1.2345, __llvm_libc::fmin(1.2345, nan)); - EXPECT_NE(isnan(__llvm_libc::fmin(nan, nan)), 0); + EXPECT_FP_EQ(inf, __llvm_libc::fmin(aNaN, inf)); + EXPECT_FP_EQ(negInf, __llvm_libc::fmin(negInf, aNaN)); + EXPECT_FP_EQ(0.0, __llvm_libc::fmin(aNaN, 0.0)); + EXPECT_FP_EQ(-0.0, __llvm_libc::fmin(-0.0, aNaN)); + EXPECT_FP_EQ(-1.2345, __llvm_libc::fmin(aNaN, -1.2345)); + EXPECT_FP_EQ(1.2345, __llvm_libc::fmin(1.2345, aNaN)); + EXPECT_NE(isnan(__llvm_libc::fmin(aNaN, aNaN)), 0); } TEST(FminTest, InfArg) { diff --git a/libc/test/src/math/fminf_test.cpp b/libc/test/src/math/fminf_test.cpp index 6772fb5..d9a01dd 100644 --- a/libc/test/src/math/fminf_test.cpp +++ b/libc/test/src/math/fminf_test.cpp @@ -17,13 +17,13 @@ using FPBits = __llvm_libc::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(FminfTest, NaNArg) { - EXPECT_FP_EQ(inf, __llvm_libc::fminf(nan, inf)); - EXPECT_FP_EQ(negInf, __llvm_libc::fminf(negInf, nan)); - EXPECT_FP_EQ(0.0f, __llvm_libc::fminf(nan, 0.0f)); - EXPECT_FP_EQ(-0.0f, __llvm_libc::fminf(-0.0f, nan)); - EXPECT_FP_EQ(-1.2345f, __llvm_libc::fminf(nan, -1.2345f)); - EXPECT_FP_EQ(1.2345f, __llvm_libc::fminf(1.2345f, nan)); - EXPECT_NE(isnan(__llvm_libc::fminf(nan, nan)), 0); + EXPECT_FP_EQ(inf, __llvm_libc::fminf(aNaN, inf)); + EXPECT_FP_EQ(negInf, __llvm_libc::fminf(negInf, aNaN)); + EXPECT_FP_EQ(0.0f, __llvm_libc::fminf(aNaN, 0.0f)); + EXPECT_FP_EQ(-0.0f, __llvm_libc::fminf(-0.0f, aNaN)); + EXPECT_FP_EQ(-1.2345f, __llvm_libc::fminf(aNaN, -1.2345f)); + EXPECT_FP_EQ(1.2345f, __llvm_libc::fminf(1.2345f, aNaN)); + EXPECT_NE(isnan(__llvm_libc::fminf(aNaN, aNaN)), 0); } TEST(FminfTest, InfArg) { diff --git a/libc/test/src/math/fminl_test.cpp b/libc/test/src/math/fminl_test.cpp index 20c88d4..75200b1 100644 --- a/libc/test/src/math/fminl_test.cpp +++ b/libc/test/src/math/fminl_test.cpp @@ -17,13 +17,13 @@ using FPBits = __llvm_libc::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(long double) TEST(FminlTest, NaNArg) { - EXPECT_FP_EQ(inf, __llvm_libc::fminl(nan, inf)); - EXPECT_FP_EQ(negInf, __llvm_libc::fminl(negInf, nan)); - EXPECT_FP_EQ(0.0L, __llvm_libc::fminl(nan, 0.0L)); - EXPECT_FP_EQ(-0.0L, __llvm_libc::fminl(-0.0L, nan)); - EXPECT_FP_EQ(-1.2345L, __llvm_libc::fminl(nan, -1.2345L)); - EXPECT_FP_EQ(1.2345L, __llvm_libc::fminl(1.2345L, nan)); - EXPECT_NE(isnan(__llvm_libc::fminl(nan, nan)), 0); + EXPECT_FP_EQ(inf, __llvm_libc::fminl(aNaN, inf)); + EXPECT_FP_EQ(negInf, __llvm_libc::fminl(negInf, aNaN)); + EXPECT_FP_EQ(0.0L, __llvm_libc::fminl(aNaN, 0.0L)); + EXPECT_FP_EQ(-0.0L, __llvm_libc::fminl(-0.0L, aNaN)); + EXPECT_FP_EQ(-1.2345L, __llvm_libc::fminl(aNaN, -1.2345L)); + EXPECT_FP_EQ(1.2345L, __llvm_libc::fminl(1.2345L, aNaN)); + EXPECT_NE(isnan(__llvm_libc::fminl(aNaN, aNaN)), 0); } TEST(FminlTest, InfArg) { diff --git a/libc/test/src/math/round_test.cpp b/libc/test/src/math/round_test.cpp index bc611d4..defa22a 100644 --- a/libc/test/src/math/round_test.cpp +++ b/libc/test/src/math/round_test.cpp @@ -26,8 +26,8 @@ TEST(RoundTest, SpecialNumbers) { EXPECT_FP_EQ(inf, __llvm_libc::round(inf)); EXPECT_FP_EQ(negInf, __llvm_libc::round(negInf)); - ASSERT_NE(isnan(nan), 0); - ASSERT_NE(isnan(__llvm_libc::round(nan)), 0); + ASSERT_NE(isnan(aNaN), 0); + ASSERT_NE(isnan(__llvm_libc::round(aNaN)), 0); } TEST(RoundTest, RoundedNumbers) { diff --git a/libc/test/src/math/roundf_test.cpp b/libc/test/src/math/roundf_test.cpp index 4a49c09..2665e81 100644 --- a/libc/test/src/math/roundf_test.cpp +++ b/libc/test/src/math/roundf_test.cpp @@ -26,8 +26,8 @@ TEST(RoundfTest, SpecialNumbers) { EXPECT_FP_EQ(inf, __llvm_libc::roundf(inf)); EXPECT_FP_EQ(negInf, __llvm_libc::roundf(negInf)); - ASSERT_NE(isnan(nan), 0); - ASSERT_NE(isnan(__llvm_libc::roundf(nan)), 0); + ASSERT_NE(isnan(aNaN), 0); + ASSERT_NE(isnan(__llvm_libc::roundf(aNaN)), 0); } TEST(RoundfTest, RoundedNumbers) { diff --git a/libc/test/src/math/roundl_test.cpp b/libc/test/src/math/roundl_test.cpp index 7b2eb6f..ff33c07 100644 --- a/libc/test/src/math/roundl_test.cpp +++ b/libc/test/src/math/roundl_test.cpp @@ -26,8 +26,8 @@ TEST(RoundlTest, SpecialNumbers) { EXPECT_FP_EQ(inf, __llvm_libc::roundl(inf)); EXPECT_FP_EQ(negInf, __llvm_libc::roundl(negInf)); - ASSERT_NE(isnan(nan), 0); - ASSERT_NE(isnan(__llvm_libc::roundl(nan)), 0); + ASSERT_NE(isnan(aNaN), 0); + ASSERT_NE(isnan(__llvm_libc::roundl(aNaN)), 0); } TEST(RoundlTest, RoundedNumbers) { diff --git a/libc/test/src/math/sqrt_test.cpp b/libc/test/src/math/sqrt_test.cpp index beec7ad..f0a1fff 100644 --- a/libc/test/src/math/sqrt_test.cpp +++ b/libc/test/src/math/sqrt_test.cpp @@ -23,12 +23,12 @@ constexpr UIntType HiddenBit = DECLARE_SPECIAL_CONSTANTS(double) TEST(SqrtTest, SpecialValues) { - ASSERT_FP_EQ(nan, __llvm_libc::sqrt(nan)); + ASSERT_FP_EQ(aNaN, __llvm_libc::sqrt(aNaN)); ASSERT_FP_EQ(inf, __llvm_libc::sqrt(inf)); - ASSERT_FP_EQ(nan, __llvm_libc::sqrt(negInf)); + ASSERT_FP_EQ(aNaN, __llvm_libc::sqrt(negInf)); ASSERT_FP_EQ(0.0, __llvm_libc::sqrt(0.0)); ASSERT_FP_EQ(-0.0, __llvm_libc::sqrt(-0.0)); - ASSERT_FP_EQ(nan, __llvm_libc::sqrt(-1.0)); + ASSERT_FP_EQ(aNaN, __llvm_libc::sqrt(-1.0)); ASSERT_FP_EQ(1.0, __llvm_libc::sqrt(1.0)); ASSERT_FP_EQ(2.0, __llvm_libc::sqrt(4.0)); ASSERT_FP_EQ(3.0, __llvm_libc::sqrt(9.0)); diff --git a/libc/test/src/math/sqrtf_test.cpp b/libc/test/src/math/sqrtf_test.cpp index b64b0d0..2f1b807 100644 --- a/libc/test/src/math/sqrtf_test.cpp +++ b/libc/test/src/math/sqrtf_test.cpp @@ -23,12 +23,12 @@ constexpr UIntType HiddenBit = DECLARE_SPECIAL_CONSTANTS(float) TEST(SqrtfTest, SpecialValues) { - ASSERT_FP_EQ(nan, __llvm_libc::sqrtf(nan)); + ASSERT_FP_EQ(aNaN, __llvm_libc::sqrtf(aNaN)); ASSERT_FP_EQ(inf, __llvm_libc::sqrtf(inf)); - ASSERT_FP_EQ(nan, __llvm_libc::sqrtf(negInf)); + ASSERT_FP_EQ(aNaN, __llvm_libc::sqrtf(negInf)); ASSERT_FP_EQ(0.0f, __llvm_libc::sqrtf(0.0f)); ASSERT_FP_EQ(-0.0f, __llvm_libc::sqrtf(-0.0f)); - ASSERT_FP_EQ(nan, __llvm_libc::sqrtf(-1.0f)); + ASSERT_FP_EQ(aNaN, __llvm_libc::sqrtf(-1.0f)); ASSERT_FP_EQ(1.0f, __llvm_libc::sqrtf(1.0f)); ASSERT_FP_EQ(2.0f, __llvm_libc::sqrtf(4.0f)); ASSERT_FP_EQ(3.0f, __llvm_libc::sqrtf(9.0f)); diff --git a/libc/test/src/math/sqrtl_test.cpp b/libc/test/src/math/sqrtl_test.cpp index 4fe03df..6e7a092 100644 --- a/libc/test/src/math/sqrtl_test.cpp +++ b/libc/test/src/math/sqrtl_test.cpp @@ -23,12 +23,12 @@ constexpr UIntType HiddenBit = DECLARE_SPECIAL_CONSTANTS(long double) TEST(SqrtlTest, SpecialValues) { - ASSERT_FP_EQ(nan, __llvm_libc::sqrtl(nan)); + ASSERT_FP_EQ(aNaN, __llvm_libc::sqrtl(aNaN)); ASSERT_FP_EQ(inf, __llvm_libc::sqrtl(inf)); - ASSERT_FP_EQ(nan, __llvm_libc::sqrtl(negInf)); + ASSERT_FP_EQ(aNaN, __llvm_libc::sqrtl(negInf)); ASSERT_FP_EQ(0.0L, __llvm_libc::sqrtl(0.0L)); ASSERT_FP_EQ(-0.0L, __llvm_libc::sqrtl(-0.0L)); - ASSERT_FP_EQ(nan, __llvm_libc::sqrtl(-1.0L)); + ASSERT_FP_EQ(aNaN, __llvm_libc::sqrtl(-1.0L)); ASSERT_FP_EQ(1.0L, __llvm_libc::sqrtl(1.0L)); ASSERT_FP_EQ(2.0L, __llvm_libc::sqrtl(4.0L)); ASSERT_FP_EQ(3.0L, __llvm_libc::sqrtl(9.0L)); diff --git a/libc/test/src/math/trunc_test.cpp b/libc/test/src/math/trunc_test.cpp index 981a729..89fa17d 100644 --- a/libc/test/src/math/trunc_test.cpp +++ b/libc/test/src/math/trunc_test.cpp @@ -26,8 +26,8 @@ TEST(TruncTest, SpecialNumbers) { EXPECT_FP_EQ(inf, __llvm_libc::trunc(inf)); EXPECT_FP_EQ(negInf, __llvm_libc::trunc(negInf)); - ASSERT_NE(isnan(nan), 0); - ASSERT_NE(isnan(__llvm_libc::trunc(nan)), 0); + ASSERT_NE(isnan(aNaN), 0); + ASSERT_NE(isnan(__llvm_libc::trunc(aNaN)), 0); } TEST(TruncTest, RoundedNumbers) { diff --git a/libc/test/src/math/truncf_test.cpp b/libc/test/src/math/truncf_test.cpp index 416eb7c..bd44ce7 100644 --- a/libc/test/src/math/truncf_test.cpp +++ b/libc/test/src/math/truncf_test.cpp @@ -26,8 +26,8 @@ TEST(TruncfTest, SpecialNumbers) { EXPECT_FP_EQ(inf, __llvm_libc::truncf(inf)); EXPECT_FP_EQ(negInf, __llvm_libc::truncf(negInf)); - ASSERT_NE(isnan(nan), 0); - ASSERT_NE(isnan(__llvm_libc::truncf(nan)), 0); + ASSERT_NE(isnan(aNaN), 0); + ASSERT_NE(isnan(__llvm_libc::truncf(aNaN)), 0); } TEST(TruncfTest, RoundedNumbers) { diff --git a/libc/test/src/math/truncl_test.cpp b/libc/test/src/math/truncl_test.cpp index 1220b7a..3c70a3a 100644 --- a/libc/test/src/math/truncl_test.cpp +++ b/libc/test/src/math/truncl_test.cpp @@ -26,8 +26,8 @@ TEST(TrunclTest, SpecialNumbers) { EXPECT_FP_EQ(inf, __llvm_libc::truncl(inf)); EXPECT_FP_EQ(negInf, __llvm_libc::truncl(negInf)); - ASSERT_NE(isnan(nan), 0); - ASSERT_NE(isnan(__llvm_libc::truncl(nan)), 0); + ASSERT_NE(isnan(aNaN), 0); + ASSERT_NE(isnan(__llvm_libc::truncl(aNaN)), 0); } TEST(TrunclTest, RoundedNumbers) { diff --git a/libc/utils/FPUtil/TestHelpers.h b/libc/utils/FPUtil/TestHelpers.h index 8addb0c..48abed8 100644 --- a/libc/utils/FPUtil/TestHelpers.h +++ b/libc/utils/FPUtil/TestHelpers.h @@ -68,7 +68,7 @@ FPMatcher getMatcher(T expectedValue) { #define DECLARE_SPECIAL_CONSTANTS(T) \ static const T zero = __llvm_libc::fputil::FPBits::zero(); \ static const T negZero = __llvm_libc::fputil::FPBits::negZero(); \ - static const T nan = __llvm_libc::fputil::FPBits::buildNaN(1); \ + static const T aNaN = __llvm_libc::fputil::FPBits::buildNaN(1); \ static const T inf = __llvm_libc::fputil::FPBits::inf(); \ static const T negInf = __llvm_libc::fputil::FPBits::negInf(); -- 2.7.4