[clang] [C23] Add *_NORM_MAX macros to <float.h> (PR #96643)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 26 04:15:43 PDT 2024


================
@@ -113,7 +113,11 @@ static T PickFP(const llvm::fltSemantics *Sem, T IEEEHalfVal, T IEEESingleVal,
 
 static void DefineFloatMacros(MacroBuilder &Builder, StringRef Prefix,
                               const llvm::fltSemantics *Sem, StringRef Ext) {
-  const char *DenormMin, *Epsilon, *Max, *Min;
+  const char *DenormMin, *NormMax, *Epsilon, *Max, *Min;
+  NormMax = PickFP(Sem, "6.5504e+4", "3.40282347e+38",
+                   "1.7976931348623157e+308", "1.18973149535723176502e+4932",
+                   "1.79769313486231580793728971405301e+308",
----------------
AaronBallman wrote:

Good catch, thank you! I see now that GCC uses the following values for `long double`:
```
#define __LDBL_MAX__ 1.79769313486231580793728971405301e+308L
#define __LDBL_NORM_MAX__ 8.98846567431157953864652595394501e+307L
```
so I should probably go with `8.98846567431157953864652595394501e+307` as the value? CC @hubert-reinterpretcast 

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


More information about the cfe-commits mailing list