[libc-commits] [libc] [libc] Unit test for isnan[f,l] (PR #98274)

via libc-commits libc-commits at lists.llvm.org
Sat Jul 13 21:30:52 PDT 2024


================
@@ -24,16 +20,13 @@ template <typename T> class IsNanTest : public LIBC_NAMESPACE::testing::Test {
   void testSpecialNumbers(IsNanFunc func) {
     EXPECT_EQ(func(zero), 0);
     EXPECT_EQ(func(neg_zero), 0);
+    EXPECT_EQ(func(inf), 0);
+    EXPECT_EQ(func(neg_inf), 0);
     EXPECT_EQ(func(aNaN), 1);
     EXPECT_EQ(func(sNaN), 1);
----------------
lntue wrote:

Can you change these to `EXPECT_NE(func(aNaN), 0);` because C standard only requires `isnan` macro to be non-zero instead of 1 for non-NaN cases.

https://github.com/llvm/llvm-project/pull/98274


More information about the libc-commits mailing list