Commit 6164b4cb0887b5331a4e64449107decd37d32735

Paul Eggert 2025-07-08T17:34:25

float-h: work around GCC bug 120993 Also, fix a too-low LDBL_MAX on this platform, a problem that contributed to LDBL_NORM_MAX test failures with C23 PowerPC GCC with ibmlongdouble. * lib/float.c (gl_LDBL_MAX): On PowerPC with ibmlongdouble, the correct value is 2**1024 - 2**918, not 2**1024 - 2**971. Also, use C99 hex double notation for the divisor, as it’s clearer and should work nowadays. * lib/float.in.h: Simplify by not worring whether it’s AIX or GNU/Linux when redefining LDBL_* macros on PowerPC GCC with ibmlongdouble, as the problem seems to be universal then. (LDBL_NORM_MAX): On PowerPC GCC with ibmlongdouble, define to be LDBL_MAX, so that it’s 2**1024 - 2**918, doubling GCC’s value if supplied. * modules/float-h-tests (Depends-on): Remove floorl, ldexpl. Add truncl. (test_float_h_LDADD): Likewise for libraries. * tests/test-float-h.c (test_isfinitel): New static function, so that we need not rely on isfinitel. (normalize_long_double): Work even if X is negative or not finite. Do not rely on frexpl or ldexpl. Use truncl instead of floorl so that the negative results are consistent with positive. Defend against fritzy PowerPC long double arithmetic.