On 2025-07-06 14:08, C. Neidahl wrote:
#define __LDBL_MAX__ 1.79769313486231580793728971405301e+308L
#define __LDBL_NORM_MAX__ 8.98846567431157953864652595394501e+307L

Wait a minute, let's get back to that older email. This value of LDBL_NORM_MAX is problematic, as ISO C 23 §5.2.5.3.3¶32 says that LDBL_NORM_MAX must equal:

  (1 - FLT_RADIX**-LDBL_MANT_DIG) * (FLT_RADIX**LDBL_MAX_EXP)

i.e.,

  FLT_RADIX**LDBL_MAX_EXP - FLT_RADIX**(LDBL_MAX_EXP - LDBL_MANT_DIG)

i.e., on this platform,

  2**1024 - 2**(1024-106)

But the number you list for __LDBL_NORM_MAX__ is half that, i.e., it's half of what C23 says it should be.

After thinking about it a bit more, I filed a GCC bug report here:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120993

and I am thinking of changing Gnulib according to the suggestion I made there. That is, I am thinking of having Gnulib override LDBL_MANT_DIG, LDBL_MAX_EXP, and LDBL_NORM_MAX on this platform, so that they equal DBL_MANT_DIG, DBL_MAX_EXP, and DBL_NORM_MAX respectively. This sort of thing should fix the test case.

Comments?

Reply via email to