[libc]NFC] Use explicit conversion on frexpl_test and logbl_test.
GitOrigin-RevId: 7db1102a101d48b7e77092c409e3aee1a369b39a
diff --git a/test/src/math/frexpl_test.cpp b/test/src/math/frexpl_test.cpp
index 6036178..053782b 100644
--- a/test/src/math/frexpl_test.cpp
+++ b/test/src/math/frexpl_test.cpp
@@ -13,6 +13,7 @@
#include "utils/UnitTest/Test.h"
#include <math.h>
+typedef long double LD;
using FPBits = __llvm_libc::fputil::FPBits<long double>;
namespace mpfr = __llvm_libc::testing::mpfr;
@@ -20,19 +21,21 @@
TEST(LlvmLibcFrexplTest, SpecialNumbers) {
int exponent;
- EXPECT_TRUE(FPBits::inf() == __llvm_libc::frexpl(FPBits::inf(), &exponent));
- EXPECT_TRUE(FPBits::negInf() ==
- __llvm_libc::frexpl(FPBits::negInf(), &exponent));
+ EXPECT_TRUE(LD(FPBits::inf()) ==
+ __llvm_libc::frexpl(LD(FPBits::inf()), &exponent));
+ EXPECT_TRUE(LD(FPBits::negInf()) ==
+ __llvm_libc::frexpl(LD(FPBits::negInf()), &exponent));
- EXPECT_TRUE(FPBits::zero() == __llvm_libc::frexpl(FPBits::zero(), &exponent));
+ EXPECT_TRUE(LD(FPBits::zero()) ==
+ __llvm_libc::frexpl(LD(FPBits::zero()), &exponent));
EXPECT_EQ(exponent, 0);
- EXPECT_TRUE(FPBits::negZero() ==
- __llvm_libc::frexpl(FPBits::negZero(), &exponent));
+ EXPECT_TRUE(LD(FPBits::negZero()) ==
+ __llvm_libc::frexpl(LD(FPBits::negZero()), &exponent));
EXPECT_EQ(exponent, 0);
EXPECT_TRUE(
- FPBits(__llvm_libc::frexpl(FPBits::buildNaN(1), &exponent)).isNaN());
+ FPBits(__llvm_libc::frexpl(LD(FPBits::buildNaN(1)), &exponent)).isNaN());
}
TEST(LlvmLibcFrexplTest, PowersOfTwo) {
diff --git a/test/src/math/logbl_test.cpp b/test/src/math/logbl_test.cpp
index f0d5afe..41a724d 100644
--- a/test/src/math/logbl_test.cpp
+++ b/test/src/math/logbl_test.cpp
@@ -12,16 +12,18 @@
#include "utils/UnitTest/Test.h"
#include <math.h>
+typedef long double LD;
using FPBits = __llvm_libc::fputil::FPBits<long double>;
TEST(LlvmLibclogblTest, SpecialNumbers) {
- EXPECT_TRUE(FPBits::inf() == __llvm_libc::logbl(FPBits::inf()));
- EXPECT_TRUE(FPBits::inf() == __llvm_libc::logbl(FPBits::negInf()));
+ EXPECT_TRUE(LD(FPBits::inf()) == __llvm_libc::logbl(LD(FPBits::inf())));
+ EXPECT_TRUE(LD(FPBits::inf()) == __llvm_libc::logbl(LD(FPBits::negInf())));
- EXPECT_TRUE(FPBits::negInf() == __llvm_libc::logbl(FPBits::zero()));
- EXPECT_TRUE(FPBits::negInf() == __llvm_libc::logbl(FPBits::negZero()));
+ EXPECT_TRUE(LD(FPBits::negInf()) == __llvm_libc::logbl(LD(FPBits::zero())));
+ EXPECT_TRUE(LD(FPBits::negInf()) ==
+ __llvm_libc::logbl(LD(FPBits::negZero())));
- EXPECT_TRUE(FPBits(__llvm_libc::logbl(FPBits::buildNaN(1))).isNaN());
+ EXPECT_TRUE(FPBits(__llvm_libc::logbl(LD(FPBits::buildNaN(1)))).isNaN());
}
TEST(LlvmLibclogblTest, PowersOfTwo) {
@@ -66,7 +68,7 @@
constexpr UIntType count = 10000000;
constexpr UIntType step = UIntType(-1) / count;
for (UIntType i = 0, v = 0; i <= count; ++i, v += step) {
- long double x = FPBits(v);
+ long double x = LD(FPBits(v));
if (isnan(x) || isinf(x) || x == 0.0l)
continue;