diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2026-03-26 12:53:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-26 12:53:53 +0100 |
| commit | 13e14a6bfd9f29cbfeab0c5161d2a994f97532e7 (patch) | |
| tree | 3aa7186fe092e42783dc7e981dc39a74ea61c466 /gl/float.in.h | |
| parent | 9d8503f90ef25b2cecd324dc118e441f40233ea8 (diff) | |
| download | monitoring-plugins-13e14a6bfd9f29cbfeab0c5161d2a994f97532e7.tar.gz | |
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
Diffstat (limited to 'gl/float.in.h')
| -rw-r--r-- | gl/float.in.h | 91 |
1 files changed, 27 insertions, 64 deletions
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 @@ | |||
| 1 | /* A correct <float.h>. | 1 | /* A correct <float.h>. |
| 2 | 2 | ||
| 3 | Copyright (C) 2007-2025 Free Software Foundation, Inc. | 3 | Copyright (C) 2007-2026 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU Lesser General Public License as | 6 | 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; | |||
| 113 | # define LDBL_MAX_10_EXP 4932 | 113 | # define LDBL_MAX_10_EXP 4932 |
| 114 | #endif | 114 | #endif |
| 115 | 115 | ||
| 116 | /* On PowerPC with gcc 15 when using __ibm128 long double, the value of | 116 | /* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are |
| 117 | LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX, and LDBL_NORM_MAX are wrong. */ | 117 | wrong. |
| 118 | On Linux/PowerPC with gcc 8.3, the values of LDBL_MAX and LDBL_EPSILON are | ||
| 119 | wrong. | ||
| 120 | Assume these bugs are fixed in any GCC new enough | ||
| 121 | to define __LDBL_NORM_MAX__. */ | ||
| 118 | #if (defined _ARCH_PPC && LDBL_MANT_DIG == 106 \ | 122 | #if (defined _ARCH_PPC && LDBL_MANT_DIG == 106 \ |
| 119 | && defined __GNUC__) | 123 | && defined __GNUC__ && !defined __LDBL_NORM_MAX__) |
| 120 | # undef LDBL_MIN_EXP | 124 | # undef LDBL_MIN_EXP |
| 121 | # define LDBL_MIN_EXP DBL_MIN_EXP | 125 | # define LDBL_MIN_EXP (-968) |
| 122 | # undef LDBL_MIN_10_EXP | 126 | # undef LDBL_MIN_10_EXP |
| 123 | # define LDBL_MIN_10_EXP DBL_MIN_10_EXP | 127 | # define LDBL_MIN_10_EXP (-291) |
| 124 | # undef LDBL_MIN | 128 | # undef LDBL_MIN |
| 125 | # define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */ | 129 | # define LDBL_MIN 0x1p-969L |
| 130 | |||
| 131 | /* IBM long double is tricky: it is represented as the sum of two doubles, | ||
| 132 | and the high double must equal the sum of the two parts rounded to nearest. | ||
| 133 | The maximum finite value for which this is true is | ||
| 134 | { 0x1.fffffffffffffp+1023, 0x1.ffffffffffffep+969 }, | ||
| 135 | which represents 0x1.fffffffffffff7ffffffffffff8p+1023L. | ||
| 136 | Although computations can yield representations of numbers larger than this, | ||
| 137 | these computations are considered to have overflowed and behavior is undefined. | ||
| 138 | See <https://gcc.gnu.org/PR120993>. */ | ||
| 126 | # undef LDBL_MAX | 139 | # undef LDBL_MAX |
| 127 | /* LDBL_MAX is 2**1024 - 2**918, represented as: { 0x7FEFFFFF, 0xFFFFFFFF, | 140 | # define LDBL_MAX 0x1.fffffffffffff7ffffffffffff8p+1023L |
| 128 | 0x7C9FFFFF, 0xFFFFFFFF }. | ||
| 129 | |||
| 130 | Do not write it as a constant expression, as GCC would likely treat | ||
| 131 | that as infinity due to the vagaries of this platform's funky arithmetic. | ||
| 132 | Instead, define it through a reference to an external variable. | ||
| 133 | Like the following, but using a union to avoid type mismatches: | ||
| 134 | |||
| 135 | const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / 0x1p53 }; | ||
| 136 | extern const long double LDBL_MAX; | ||
| 137 | |||
| 138 | The following alternative would not work as well when GCC is optimizing: | ||
| 139 | |||
| 140 | #define LDBL_MAX (*(long double const *) (double[]) | ||
| 141 | { DBL_MAX, DBL_MAX / 0x1p53 }) | ||
| 142 | |||
| 143 | The following alternative would require GCC 6 or later: | ||
| 144 | |||
| 145 | #define LDBL_MAX __builtin_pack_longdouble (DBL_MAX, DBL_MAX / 0x1p53) | ||
| 146 | |||
| 147 | Unfortunately none of the alternatives are constant expressions. */ | ||
| 148 | # if !GNULIB_defined_long_double_union | ||
| 149 | union gl_long_double_union | ||
| 150 | { | ||
| 151 | struct { double hi; double lo; } dd; | ||
| 152 | long double ld; | ||
| 153 | }; | ||
| 154 | # define GNULIB_defined_long_double_union 1 | ||
| 155 | # endif | ||
| 156 | extern const union gl_long_double_union gl_LDBL_MAX; | ||
| 157 | # define LDBL_MAX (gl_LDBL_MAX.ld) | ||
| 158 | # undef LDBL_NORM_MAX | ||
| 159 | # define LDBL_NORM_MAX LDBL_MAX | ||
| 160 | #endif | ||
| 161 | |||
| 162 | /* On IRIX 6.5, with cc, the value of LDBL_MANT_DIG is wrong. | ||
| 163 | On IRIX 6.5, with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_EPSILON | ||
| 164 | are wrong. */ | ||
| 165 | #if defined __sgi && (LDBL_MANT_DIG >= 106) | ||
| 166 | # undef LDBL_MANT_DIG | ||
| 167 | # define LDBL_MANT_DIG 106 | ||
| 168 | # if defined __GNUC__ | ||
| 169 | # undef LDBL_MIN_EXP | ||
| 170 | # define LDBL_MIN_EXP DBL_MIN_EXP | ||
| 171 | # undef LDBL_MIN_10_EXP | ||
| 172 | # define LDBL_MIN_10_EXP DBL_MIN_10_EXP | ||
| 173 | # undef LDBL_MIN | ||
| 174 | # define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */ | ||
| 175 | # undef LDBL_EPSILON | ||
| 176 | # define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */ | ||
| 177 | # endif | ||
| 178 | #endif | ||
| 179 | 141 | ||
| 180 | /* On PowerPC platforms, 'long double' has a double-double representation. | 142 | /* On PowerPC platforms, 'long double' has a double-double representation. |
| 181 | Up to ISO C 17, this was outside the scope of ISO C because it can represent | 143 | 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; | |||
| 187 | numbers with mantissas of the form 1.<52 bits><many zeroes><52 bits> are | 149 | numbers with mantissas of the form 1.<52 bits><many zeroes><52 bits> are |
| 188 | called "unnormalized". And since LDBL_EPSILON must be normalized (per | 150 | called "unnormalized". And since LDBL_EPSILON must be normalized (per |
| 189 | ISO C 23 § 5.2.5.3.3.(33)), it must be 2^-105. */ | 151 | ISO C 23 § 5.2.5.3.3.(33)), it must be 2^-105. */ |
| 190 | #if defined __powerpc__ && LDBL_MANT_DIG == 106 | ||
| 191 | # undef LDBL_EPSILON | 152 | # undef LDBL_EPSILON |
| 192 | # define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */ | 153 | # define LDBL_EPSILON 0x1p-105L |
| 193 | #endif | 154 | #endif |
| 194 | 155 | ||
| 195 | /* ============================ ISO C11 support ============================ */ | 156 | /* ============================ ISO C11 support ============================ */ |
| @@ -273,7 +234,7 @@ extern const union gl_long_double_union gl_LDBL_TRUE_MIN; | |||
| 273 | # define FLT_NORM_MAX FLT_MAX | 234 | # define FLT_NORM_MAX FLT_MAX |
| 274 | #endif | 235 | #endif |
| 275 | #ifndef FLT_SNAN | 236 | #ifndef FLT_SNAN |
| 276 | /* For sh, beware of <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111814>. */ | 237 | /* For sh, beware of <https://gcc.gnu.org/PR111814>. */ |
| 277 | # if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__ | 238 | # if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__ |
| 278 | # define FLT_SNAN __builtin_nansf ("") | 239 | # define FLT_SNAN __builtin_nansf ("") |
| 279 | # else | 240 | # else |
| @@ -297,7 +258,7 @@ extern gl_FLT_SNAN_t gl_FLT_SNAN; | |||
| 297 | # define DBL_NORM_MAX DBL_MAX | 258 | # define DBL_NORM_MAX DBL_MAX |
| 298 | #endif | 259 | #endif |
| 299 | #ifndef DBL_SNAN | 260 | #ifndef DBL_SNAN |
| 300 | /* For sh, beware of <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111814>. */ | 261 | /* For sh, beware of <https://gcc.gnu.org/PR111814>. */ |
| 301 | # if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__ | 262 | # if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__ |
| 302 | # define DBL_SNAN __builtin_nans ("") | 263 | # define DBL_SNAN __builtin_nans ("") |
| 303 | # else | 264 | # else |
| @@ -322,12 +283,14 @@ extern gl_DBL_SNAN_t gl_DBL_SNAN; | |||
| 322 | #ifndef LDBL_NORM_MAX | 283 | #ifndef LDBL_NORM_MAX |
| 323 | # ifdef __LDBL_NORM_MAX__ | 284 | # ifdef __LDBL_NORM_MAX__ |
| 324 | # define LDBL_NORM_MAX __LDBL_NORM_MAX__ | 285 | # define LDBL_NORM_MAX __LDBL_NORM_MAX__ |
| 286 | # elif FLT_RADIX == 2 && LDBL_MAX_EXP == 1024 && LDBL_MANT_DIG == 106 | ||
| 287 | # define LDBL_NORM_MAX 0x1.ffffffffffffffffffffffffff8p+1022L | ||
| 325 | # else | 288 | # else |
| 326 | # define LDBL_NORM_MAX LDBL_MAX | 289 | # define LDBL_NORM_MAX LDBL_MAX |
| 327 | # endif | 290 | # endif |
| 328 | #endif | 291 | #endif |
| 329 | #ifndef LDBL_SNAN | 292 | #ifndef LDBL_SNAN |
| 330 | /* For sh, beware of <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111814>. */ | 293 | /* For sh, beware of <https://gcc.gnu.org/PR111814>. */ |
| 331 | # if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__ | 294 | # if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__ |
| 332 | # define LDBL_SNAN __builtin_nansl ("") | 295 | # define LDBL_SNAN __builtin_nansl ("") |
| 333 | # else | 296 | # else |
