aboutsummaryrefslogtreecommitdiff
path: root/libc/test
diff options
context:
space:
mode:
authorSiva Chandra Reddy <sivachandra@google.com>2020-10-27 13:12:18 -0700
committerSiva Chandra Reddy <sivachandra@google.com>2020-10-27 16:55:16 -0700
commite4be4bcf83d9ed4888e42940deb6b6c8dceefa46 (patch)
treec6cd62d5806f5ac1300f06565ab7f555f47f0a52 /libc/test
parentd69ada30e23f1b226daeee3a9b13826e1e368ede (diff)
downloadllvm-project-e4be4bcf83d9ed4888e42940deb6b6c8dceefa46.tar.gz
[libc][NFC] Use a convenience macro to declare special floating point constants.
Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D90262
Diffstat (limited to 'libc/test')
-rw-r--r--libc/test/src/math/remquo_test.cpp6
-rw-r--r--libc/test/src/math/remquof_test.cpp6
-rw-r--r--libc/test/src/math/remquol_test.cpp12
3 files changed, 6 insertions, 18 deletions
diff --git a/libc/test/src/math/remquo_test.cpp b/libc/test/src/math/remquo_test.cpp
index 0ebbed7224b2..44812f1c1d53 100644
--- a/libc/test/src/math/remquo_test.cpp
+++ b/libc/test/src/math/remquo_test.cpp
@@ -19,11 +19,7 @@ using UIntType = FPBits::UIntType;
namespace mpfr = __llvm_libc::testing::mpfr;
-static const double zero = FPBits::zero();
-static const double negZero = FPBits::negZero();
-static const double nan = FPBits::buildNaN(1);
-static const double inf = FPBits::inf();
-static const double negInf = FPBits::negInf();
+DECLARE_SPECIAL_CONSTANTS(double)
TEST(RemquoTest, SpecialNumbers) {
int exponent;
diff --git a/libc/test/src/math/remquof_test.cpp b/libc/test/src/math/remquof_test.cpp
index 0c51d5f5324d..81c262f5320c 100644
--- a/libc/test/src/math/remquof_test.cpp
+++ b/libc/test/src/math/remquof_test.cpp
@@ -19,11 +19,7 @@ using UIntType = FPBits::UIntType;
namespace mpfr = __llvm_libc::testing::mpfr;
-static const float zero = FPBits::zero();
-static const float negZero = FPBits::negZero();
-static const float nan = FPBits::buildNaN(1);
-static const float inf = FPBits::inf();
-static const float negInf = FPBits::negInf();
+DECLARE_SPECIAL_CONSTANTS(float)
TEST(RemquofTest, SpecialNumbers) {
int exponent;
diff --git a/libc/test/src/math/remquol_test.cpp b/libc/test/src/math/remquol_test.cpp
index eab3a5fb1fa6..63500cb519a3 100644
--- a/libc/test/src/math/remquol_test.cpp
+++ b/libc/test/src/math/remquol_test.cpp
@@ -19,13 +19,9 @@ using UIntType = FPBits::UIntType;
namespace mpfr = __llvm_libc::testing::mpfr;
-static const long double zero = FPBits::zero();
-static const long double negZero = FPBits::negZero();
-static const long double nan = FPBits::buildNaN(1);
-static const long double inf = FPBits::inf();
-static const long double negInf = FPBits::negInf();
+DECLARE_SPECIAL_CONSTANTS(long double)
-TEST(RemquoTest, SpecialNumbers) {
+TEST(RemquolTest, SpecialNumbers) {
int exponent;
long double x, y;
@@ -62,7 +58,7 @@ TEST(RemquoTest, SpecialNumbers) {
EXPECT_FP_EQ(__llvm_libc::remquol(x, y, &exponent), negZero);
}
-TEST(RemquofTest, SubnormalRange) {
+TEST(RemquolTest, SubnormalRange) {
constexpr UIntType count = 1000001;
constexpr UIntType step =
(FPBits::maxSubnormal - FPBits::minSubnormal) / count;
@@ -77,7 +73,7 @@ TEST(RemquofTest, SubnormalRange) {
}
}
-TEST(RemquofTest, NormalRange) {
+TEST(RemquolTest, NormalRange) {
constexpr UIntType count = 1000001;
constexpr UIntType step = (FPBits::maxNormal - FPBits::minNormal) / count;
for (UIntType v = FPBits::minNormal, w = FPBits::maxNormal;