[libc-commits] [PATCH] D115892: [libc] Fix problem with using isnan in test/src/math/logf_test.cpp.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Dec 16 11:44:47 PST 2021


lntue created this revision.
lntue added a reviewer: sivachandra.
Herald added subscribers: ecnelises, tschuett.
Herald added a project: libc-project.
lntue requested review of this revision.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115892

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


Index: libc/test/src/math/logf_test.cpp
===================================================================
--- libc/test/src/math/logf_test.cpp
+++ libc/test/src/math/logf_test.cpp
@@ -23,10 +23,10 @@
 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));
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115892.394942.patch
Type: text/x-patch
Size: 716 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20211216/62f13291/attachment.bin>


More information about the libc-commits mailing list