From 82c19bdfe39164fda779c79a925c2050b19e421b Mon Sep 17 00:00:00 2001 From: "Paul E. Murphy" Date: Fri, 4 Nov 2016 09:57:27 -0200 Subject: float128: Extend the power of ten tables Update the power of ten tables used by the common implementation when long double is not the most expressive real type. * stdlib/fpioconst.h: Include bits/floatn.h. (FPIOCONST_HAVE_EXTENDED_RANGE): New macro for testing how big the power of ten table should be. (FPIOCONST_POW10_ARRAY_SIZE): Use larger table if above is true. * stdlib/fpioconst.c (__tens): Use FPIOCONST_HAVE_EXTENDED_RANGE to include larger tables when _Float128 support is enabled. (_fpioconst_pow10): Likewise. --- stdlib/fpioconst.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'stdlib/fpioconst.h') diff --git a/stdlib/fpioconst.h b/stdlib/fpioconst.h index 6fc476b..2559d7a 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 + /* 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 -- cgit v1.1