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;
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;
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;
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;
}
}
-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;
} // namespace fputil
} // namespace __llvm_libc
+#define DECLARE_SPECIAL_CONSTANTS(T) \
+ static const T zero = __llvm_libc::fputil::FPBits<T>::zero(); \
+ static const T negZero = __llvm_libc::fputil::FPBits<T>::negZero(); \
+ static const T nan = __llvm_libc::fputil::FPBits<T>::buildNaN(1); \
+ static const T inf = __llvm_libc::fputil::FPBits<T>::inf(); \
+ static const T negInf = __llvm_libc::fputil::FPBits<T>::negInf();
+
#define EXPECT_FP_EQ(expected, actual) \
EXPECT_THAT( \
actual, \