[libc-commits] [libc] 7db1102 - [libc]NFC] Use explicit conversion on frexpl_test and logbl_test.
Siva Chandra Reddy via libc-commits
libc-commits at lists.llvm.org
Fri Apr 16 22:50:41 PDT 2021
Author: Siva Chandra Reddy
Date: 2021-04-17T05:50:00Z
New Revision: 7db1102a101d48b7e77092c409e3aee1a369b39a
URL: https://github.com/llvm/llvm-project/commit/7db1102a101d48b7e77092c409e3aee1a369b39a
DIFF: https://github.com/llvm/llvm-project/commit/7db1102a101d48b7e77092c409e3aee1a369b39a.diff
LOG: [libc]NFC] Use explicit conversion on frexpl_test and logbl_test.
Added:
Modified:
libc/test/src/math/frexpl_test.cpp
libc/test/src/math/logbl_test.cpp
Removed:
################################################################################
diff --git a/libc/test/src/math/frexpl_test.cpp b/libc/test/src/math/frexpl_test.cpp
index 6036178a3192..053782b0ba10 100644
--- a/libc/test/src/math/frexpl_test.cpp
+++ b/libc/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 @@ namespace mpfr = __llvm_libc::testing::mpfr;
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/libc/test/src/math/logbl_test.cpp b/libc/test/src/math/logbl_test.cpp
index f0d5afe328c6..41a724d95b32 100644
--- a/libc/test/src/math/logbl_test.cpp
+++ b/libc/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 @@ TEST(LlvmLibcLogblTest, LongDoubleRange) {
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;
More information about the libc-commits
mailing list