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

via libc-commits libc-commits at lists.llvm.org
Tue Aug 13 13:52:28 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Joseph Huber (jhuber6)

<details>
<summary>Changes</summary>

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.


---
Full diff: https://github.com/llvm/llvm-project/pull/103445.diff


1 Files Affected:

- (modified) libc/include/llvm-libc-macros/math-macros.h (+1-1) 


``````````diff
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)

``````````

</details>


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


More information about the libc-commits mailing list