From 13e14a6bfd9f29cbfeab0c5161d2a994f97532e7 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 26 Mar 2026 12:53:53 +0100 Subject: Update/gnulib 2026 03 (#2247) * Sync with the 202601-stable Gnulib code (4a3650d887) * Ignore more deps stuff in gnulib * Remove autogenerated gnulib files * Ignore more gnulib generated headers --- gl/float.in.h | 91 ++++++++++++++++++----------------------------------------- 1 file changed, 27 insertions(+), 64 deletions(-) (limited to 'gl/float.in.h') diff --git a/gl/float.in.h b/gl/float.in.h index d75a06e7..9f735cb9 100644 --- a/gl/float.in.h +++ b/gl/float.in.h @@ -1,6 +1,6 @@ /* A correct . - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -113,69 +113,31 @@ extern const union gl_long_double_union gl_LDBL_MAX; # define LDBL_MAX_10_EXP 4932 #endif -/* On PowerPC with gcc 15 when using __ibm128 long double, the value of - LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX, and LDBL_NORM_MAX are wrong. */ +/* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are + wrong. + On Linux/PowerPC with gcc 8.3, the values of LDBL_MAX and LDBL_EPSILON are + wrong. + Assume these bugs are fixed in any GCC new enough + to define __LDBL_NORM_MAX__. */ #if (defined _ARCH_PPC && LDBL_MANT_DIG == 106 \ - && defined __GNUC__) + && defined __GNUC__ && !defined __LDBL_NORM_MAX__) # undef LDBL_MIN_EXP -# define LDBL_MIN_EXP DBL_MIN_EXP +# define LDBL_MIN_EXP (-968) # undef LDBL_MIN_10_EXP -# define LDBL_MIN_10_EXP DBL_MIN_10_EXP +# define LDBL_MIN_10_EXP (-291) # undef LDBL_MIN -# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */ +# define LDBL_MIN 0x1p-969L + +/* IBM long double is tricky: it is represented as the sum of two doubles, + and the high double must equal the sum of the two parts rounded to nearest. + The maximum finite value for which this is true is + { 0x1.fffffffffffffp+1023, 0x1.ffffffffffffep+969 }, + which represents 0x1.fffffffffffff7ffffffffffff8p+1023L. + Although computations can yield representations of numbers larger than this, + these computations are considered to have overflowed and behavior is undefined. + See . */ # undef LDBL_MAX -/* LDBL_MAX is 2**1024 - 2**918, represented as: { 0x7FEFFFFF, 0xFFFFFFFF, - 0x7C9FFFFF, 0xFFFFFFFF }. - - Do not write it as a constant expression, as GCC would likely treat - that as infinity due to the vagaries of this platform's funky arithmetic. - Instead, define it through a reference to an external variable. - Like the following, but using a union to avoid type mismatches: - - const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / 0x1p53 }; - extern const long double LDBL_MAX; - - The following alternative would not work as well when GCC is optimizing: - - #define LDBL_MAX (*(long double const *) (double[]) - { DBL_MAX, DBL_MAX / 0x1p53 }) - - The following alternative would require GCC 6 or later: - - #define LDBL_MAX __builtin_pack_longdouble (DBL_MAX, DBL_MAX / 0x1p53) - - Unfortunately none of the alternatives are constant expressions. */ -# if !GNULIB_defined_long_double_union -union gl_long_double_union - { - struct { double hi; double lo; } dd; - long double ld; - }; -# define GNULIB_defined_long_double_union 1 -# endif -extern const union gl_long_double_union gl_LDBL_MAX; -# define LDBL_MAX (gl_LDBL_MAX.ld) -# undef LDBL_NORM_MAX -# define LDBL_NORM_MAX LDBL_MAX -#endif - -/* On IRIX 6.5, with cc, the value of LDBL_MANT_DIG is wrong. - On IRIX 6.5, with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_EPSILON - are wrong. */ -#if defined __sgi && (LDBL_MANT_DIG >= 106) -# undef LDBL_MANT_DIG -# define LDBL_MANT_DIG 106 -# if defined __GNUC__ -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP DBL_MIN_EXP -# undef LDBL_MIN_10_EXP -# define LDBL_MIN_10_EXP DBL_MIN_10_EXP -# undef LDBL_MIN -# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */ -# undef LDBL_EPSILON -# define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */ -# endif -#endif +# define LDBL_MAX 0x1.fffffffffffff7ffffffffffff8p+1023L /* On PowerPC platforms, 'long double' has a double-double representation. Up to ISO C 17, this was outside the scope of ISO C because it can represent @@ -187,9 +149,8 @@ extern const union gl_long_double_union gl_LDBL_MAX; numbers with mantissas of the form 1.<52 bits><52 bits> are called "unnormalized". And since LDBL_EPSILON must be normalized (per ISO C 23 § 5.2.5.3.3.(33)), it must be 2^-105. */ -#if defined __powerpc__ && LDBL_MANT_DIG == 106 # undef LDBL_EPSILON -# define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */ +# define LDBL_EPSILON 0x1p-105L #endif /* ============================ ISO C11 support ============================ */ @@ -273,7 +234,7 @@ extern const union gl_long_double_union gl_LDBL_TRUE_MIN; # define FLT_NORM_MAX FLT_MAX #endif #ifndef FLT_SNAN -/* For sh, beware of . */ +/* For sh, beware of . */ # if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__ # define FLT_SNAN __builtin_nansf ("") # else @@ -297,7 +258,7 @@ extern gl_FLT_SNAN_t gl_FLT_SNAN; # define DBL_NORM_MAX DBL_MAX #endif #ifndef DBL_SNAN -/* For sh, beware of . */ +/* For sh, beware of . */ # if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__ # define DBL_SNAN __builtin_nans ("") # else @@ -322,12 +283,14 @@ extern gl_DBL_SNAN_t gl_DBL_SNAN; #ifndef LDBL_NORM_MAX # ifdef __LDBL_NORM_MAX__ # define LDBL_NORM_MAX __LDBL_NORM_MAX__ +# elif FLT_RADIX == 2 && LDBL_MAX_EXP == 1024 && LDBL_MANT_DIG == 106 +# define LDBL_NORM_MAX 0x1.ffffffffffffffffffffffffff8p+1022L # else # define LDBL_NORM_MAX LDBL_MAX # endif #endif #ifndef LDBL_SNAN -/* For sh, beware of . */ +/* For sh, beware of . */ # if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__ # define LDBL_SNAN __builtin_nansl ("") # else -- cgit v1.2.3-74-g34f1