diff options
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/fpioconst.c | 8 | ||||
-rw-r--r-- | stdlib/fpioconst.h | 14 |
2 files changed, 16 insertions, 6 deletions
diff --git a/stdlib/fpioconst.c b/stdlib/fpioconst.c index 7db7fa4508..a0563b9676 100644 --- a/stdlib/fpioconst.c +++ b/stdlib/fpioconst.c @@ -112,7 +112,7 @@ const mp_limb_t __tens[] = 0xd2db49ef, 0x926c3f5b, 0xae6209d4, 0x2d433949, 0x34f4a3c6, 0xd4305d94, 0xd9d61a05, 0x00000325, -#if !defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024 +#if FPIOCONST_HAVE_EXTENDED_RANGE # define TENS_P11_IDX (TENS_P10_IDX + TENS_P10_SIZE) # define TENS_P11_SIZE 215 [TENS_P11_IDX] = 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -659,7 +659,7 @@ const mp_limb_t __tens[] = 0x6d6c0267, 0x06f9c25b, 0xbd6078e0, 0xb5fcdc81, 0xd742fa41, 0xcccc2399, 0xc691adc0, 0x215ad82c, 0xea73b0c3, 0xa511e5b0, 0xf499e0a6, 0x53e27ab0, 0xd94440a2, 0x47752521, 0x9a6e3644, 0xab113708, 0x8f8b301d, 0x058a42a3, -#endif /* !__NO_LONG_DOUBLE_MATH */ +#endif /* FPIOCONST_HAVE_EXTENDED_RANGE */ }; #elif BITS_PER_MP_LIMB == 64 @@ -748,7 +748,7 @@ const mp_limb_t __tens[] = 0xd2db49ef47187094ull, 0xae6209d4926c3f5bull, 0x34f4a3c62d433949ull, 0xd9d61a05d4305d94ull, 0x0000000000000325ull, -#if !defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024 +#if FPIOCONST_HAVE_EXTENDED_RANGE # define TENS_P11_IDX (TENS_P10_IDX + TENS_P10_SIZE) # define TENS_P11_SIZE 108 [TENS_P11_IDX] = 0x0000000000000000ull, 0x0000000000000000ull, @@ -1320,7 +1320,7 @@ const struct mp_power _fpioconst_pow10[FPIOCONST_POW10_ARRAY_SIZE] = { TENS_P8_IDX, TENS_P8_SIZE, 851, 848 }, { TENS_P9_IDX, TENS_P9_SIZE, 1701, 1698 }, { TENS_P10_IDX, TENS_P10_SIZE, 3402, 3399 }, -#if !defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024 +#if FPIOCONST_HAVE_EXTENDED_RANGE { TENS_P11_IDX, TENS_P11_SIZE, 6804, 6800 }, { TENS_P12_IDX, TENS_P12_SIZE, 13607, 13604 }, { TENS_P13_IDX, TENS_P13_SIZE, 27214, 27210 }, diff --git a/stdlib/fpioconst.h b/stdlib/fpioconst.h index 6fc476b074..2559d7a74c 100644 --- a/stdlib/fpioconst.h +++ b/stdlib/fpioconst.h @@ -40,9 +40,19 @@ #define DBL_MAX_10_EXP_LOG 8 /* = floor(log_2(DBL_MAX_10_EXP)) */ #define FLT_MAX_10_EXP_LOG 5 /* = floor(log_2(FLT_MAX_10_EXP)) */ +/* On some machines, _Float128 may be ABI-distinct from long double (e.g + IBM extended precision). */ +#include <bits/floatn.h> + /* For strtold, we need powers of 10 up to floor (log_2 (LDBL_MANT_DIG - - LDBL_MIN_EXP + 2)). */ -#if !defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024 + - LDBL_MIN_EXP + 2)). When _Float128 is enabled in libm and it is + ABI-distinct from long double (e.g. on powerpc64le), we also need powers + of 10 up to floor (log_2 (FLT128_MANT_DIG - FLT128_MIN_EXP + 2)). */ +#define FPIOCONST_HAVE_EXTENDED_RANGE \ + ((!defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024) \ + || __HAVE_DISTINCT_FLOAT128) + +#if FPIOCONST_HAVE_EXTENDED_RANGE # define FPIOCONST_POW10_ARRAY_SIZE 15 #else # define FPIOCONST_POW10_ARRAY_SIZE 11 |