[libc-commits] [libc] 4036b12 - [libc] Fix problem with using isnan in test/src/math/logf_test.cpp.

Tue Ly via libc-commits libc-commits at lists.llvm.org
Thu Dec 16 11:51:24 PST 2021


Author: Tue Ly
Date: 2021-12-16T14:51:10-05:00
New Revision: 4036b12d969cb95d1b68830bcd989126d9119de9

URL: https://github.com/llvm/llvm-project/commit/4036b12d969cb95d1b68830bcd989126d9119de9
DIFF: https://github.com/llvm/llvm-project/commit/4036b12d969cb95d1b68830bcd989126d9119de9.diff

LOG: [libc] Fix problem with using isnan in test/src/math/logf_test.cpp.

The default isnan returns an int, and hence failing the EXPECT_TRUE tests.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D115892

Added: 
    

Modified: 
    libc/test/src/math/logf_test.cpp

Removed: 
    


################################################################################
diff  --git a/libc/test/src/math/logf_test.cpp b/libc/test/src/math/logf_test.cpp
index 6cee7f74cf0e1..a3ada693a3cb3 100644
--- a/libc/test/src/math/logf_test.cpp
+++ b/libc/test/src/math/logf_test.cpp
@@ -23,10 +23,10 @@ DECLARE_SPECIAL_CONSTANTS(float)
 TEST(LlvmLibcLogfTest, SpecialNumbers) {
   EXPECT_FP_EQ(aNaN, __llvm_libc::logf(aNaN));
   EXPECT_FP_EQ(inf, __llvm_libc::logf(inf));
-  EXPECT_TRUE(isnan(__llvm_libc::logf(neg_inf)));
+  EXPECT_TRUE(FPBits((__llvm_libc::logf(neg_inf))).is_nan());
   EXPECT_FP_EQ(neg_inf, __llvm_libc::logf(0.0f));
   EXPECT_FP_EQ(neg_inf, __llvm_libc::logf(-0.0f));
-  EXPECT_TRUE(isnan(__llvm_libc::logf(-1.0f)));
+  EXPECT_TRUE(FPBits(__llvm_libc::logf(-1.0f)).is_nan());
   EXPECT_FP_EQ(zero, __llvm_libc::logf(1.0f));
 }
 


        


More information about the libc-commits mailing list