[libc-commits] [libc] ef0ea87 - [libc][NFC] Adjust sinf and cosf around -infinity inputs.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Tue Jun 9 16:30:42 PDT 2020


Author: Siva Chandra Reddy
Date: 2020-06-09T16:23:12-07:00
New Revision: ef0ea8717a9b513d2bf67c2b04b876700593fa07

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

LOG: [libc][NFC] Adjust sinf and cosf around -infinity inputs.

The current tests verify if the result of -infinity is a quiet NaN with
sign bit set. But, that need not be the case on all platforms. So, just
checking that the result is a quiet NaN and ignoring the sign bit is
good enough.

Added: 
    

Modified: 
    libc/test/src/math/cosf_test.cpp
    libc/test/src/math/sinf_test.cpp

Removed: 
    


################################################################################
diff  --git a/libc/test/src/math/cosf_test.cpp b/libc/test/src/math/cosf_test.cpp
index 1f9dffd87c10..3ba0fcd1cd98 100644
--- a/libc/test/src/math/cosf_test.cpp
+++ b/libc/test/src/math/cosf_test.cpp
@@ -68,8 +68,8 @@ TEST(CosfTest, SpecialNumbers) {
   EXPECT_EQ(llvmlibc_errno, EDOM);
 
   llvmlibc_errno = 0;
-  EXPECT_TRUE(isNegativeQuietNaN(
-      __llvm_libc::cosf(valueFromBits(BitPatterns::negInf))));
+  EXPECT_TRUE(
+      isQuietNaN(__llvm_libc::cosf(valueFromBits(BitPatterns::negInf))));
   EXPECT_EQ(llvmlibc_errno, EDOM);
 }
 

diff  --git a/libc/test/src/math/sinf_test.cpp b/libc/test/src/math/sinf_test.cpp
index 437281ada43a..115359baf0ce 100644
--- a/libc/test/src/math/sinf_test.cpp
+++ b/libc/test/src/math/sinf_test.cpp
@@ -68,8 +68,8 @@ TEST(SinfTest, SpecialNumbers) {
   EXPECT_EQ(llvmlibc_errno, EDOM);
 
   llvmlibc_errno = 0;
-  EXPECT_TRUE(isNegativeQuietNaN(
-      __llvm_libc::sinf(valueFromBits(BitPatterns::negInf))));
+  EXPECT_TRUE(
+      isQuietNaN(__llvm_libc::sinf(valueFromBits(BitPatterns::negInf))));
   EXPECT_EQ(llvmlibc_errno, EDOM);
 }
 


        


More information about the libc-commits mailing list