[libc-commits] [libc] 6cd37eb - [libc] Fix `INFINITY` being defined as a double (#103445)

via libc-commits libc-commits at lists.llvm.org
Tue Aug 13 14:02:22 PDT 2024


Author: Joseph Huber
Date: 2024-08-13T16:02:18-05:00
New Revision: 6cd37eb5deb4400e16a7ce3760abe175a8476eff

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

LOG: [libc] Fix `INFINITY` being defined as a double (#103445)

Summary:
If the implementation supports floating-point infinities, the macro
INFINITY expands to constant expression of type float which evaluates to
positive or unsigned infinity.

Currently this is a double, this makes it a float.

Added: 
    

Modified: 
    libc/include/llvm-libc-macros/math-macros.h

Removed: 
    


################################################################################
diff  --git a/libc/include/llvm-libc-macros/math-macros.h b/libc/include/llvm-libc-macros/math-macros.h
index 0ceb2c5c8202b0..2f05d7544666e6 100644
--- a/libc/include/llvm-libc-macros/math-macros.h
+++ b/libc/include/llvm-libc-macros/math-macros.h
@@ -28,7 +28,7 @@
 
 #define HUGE_VAL __builtin_huge_val()
 #define HUGE_VALF __builtin_huge_valf()
-#define INFINITY __builtin_inf()
+#define INFINITY __builtin_inff()
 #define NAN __builtin_nanf("")
 
 #define FP_ILOGB0 (-INT_MAX - 1)


        


More information about the libc-commits mailing list