[libc-commits] [libc] 83193a5 - [libc] Raise FE_INVALID for sinf with +- inf inputs.

Tue Ly via libc-commits libc-commits at lists.llvm.org
Mon Jul 25 07:21:43 PDT 2022


Author: Tue Ly
Date: 2022-07-25T10:20:32-04:00
New Revision: 83193a5e723a0684fe656dc77161afb89898b933

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

LOG: [libc] Raise FE_INVALID for sinf with +- inf inputs.

Added: 
    

Modified: 
    libc/src/math/generic/sinf.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/math/generic/sinf.cpp b/libc/src/math/generic/sinf.cpp
index 3175088ec1751..facf16b03f803 100644
--- a/libc/src/math/generic/sinf.cpp
+++ b/libc/src/math/generic/sinf.cpp
@@ -159,8 +159,10 @@ LLVM_LIBC_FUNCTION(float, sinf, (float x)) {
   } else {
     // x is inf or nan.
     if (unlikely(x_abs >= 0x7f80'0000U)) {
-      if (x_abs == 0x7f80'0000U)
+      if (x_abs == 0x7f80'0000U) {
         errno = EDOM;
+        fputil::set_except(FE_INVALID);
+      }
       return x +
              FPBits::build_nan(1 << (fputil::MantissaWidth<float>::VALUE - 1));
     }


        


More information about the libc-commits mailing list