aboutsummaryrefslogtreecommitdiff
path: root/stdlib/fpioconst.h
diff options
context:
space:
mode:
authorPaul E. Murphy <murphyp@linux.vnet.ibm.com>2016-11-04 09:57:27 -0200
committerGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>2017-06-07 16:58:42 -0300
commit82c19bdfe39164fda779c79a925c2050b19e421b (patch)
tree0867224cd0c83e3383fde82ac3875b61e1f7480f /stdlib/fpioconst.h
parent81df4d253dc3184fb003e4737b917e8d35c341d1 (diff)
downloadglibc-82c19bdfe39164fda779c79a925c2050b19e421b.zip
glibc-82c19bdfe39164fda779c79a925c2050b19e421b.tar.gz
glibc-82c19bdfe39164fda779c79a925c2050b19e421b.tar.bz2
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.
Diffstat (limited to 'stdlib/fpioconst.h')
-rw-r--r--stdlib/fpioconst.h14
1 files changed, 12 insertions, 2 deletions
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 <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