summary refs log tree commit diff
path: root/stdlib/fpioconst.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-08-27 16:01:27 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-08-27 16:02:07 +0000
commitaf92131a8eb7c2661a5bb0e31dc4cb028c85e0c6 (patch)
tree314e393e8358ea722cc43c6a6ac8660fa5e71e6b /stdlib/fpioconst.h
parentd6e70f4368533224e66d10b7f2126b899a3fd5e4 (diff)
downloadglibc-af92131a8eb7c2661a5bb0e31dc4cb028c85e0c6.tar.gz
glibc-af92131a8eb7c2661a5bb0e31dc4cb028c85e0c6.tar.xz
glibc-af92131a8eb7c2661a5bb0e31dc4cb028c85e0c6.zip
Fix strtod rounding (bug 3479).
Diffstat (limited to 'stdlib/fpioconst.h')
-rw-r--r--stdlib/fpioconst.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/stdlib/fpioconst.h b/stdlib/fpioconst.h
index 5ab19f5bf1..34478b71cf 100644
--- a/stdlib/fpioconst.h
+++ b/stdlib/fpioconst.h
@@ -1,6 +1,5 @@
 /* Header file for constants used in floating point <-> decimal conversions.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2002, 2003
-   Free Software Foundation, Inc.
+   Copyright (C) 1995-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -41,6 +40,13 @@
 #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)) */
 
+/* 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
+# define FPIOCONST_POW10_ARRAY_SIZE	15
+#else
+# define FPIOCONST_POW10_ARRAY_SIZE	11
+#endif
 
 /* The array with the number representation. */
 extern const mp_limb_t __tens[] attribute_hidden;
@@ -54,7 +60,7 @@ struct mp_power
     int p_expo;			/* Exponent of the number 10^(2^i).  */
     int m_expo;			/* Exponent of the number 10^-(2^i-1).  */
   };
-extern const struct mp_power _fpioconst_pow10[LDBL_MAX_10_EXP_LOG + 1]
+extern const struct mp_power _fpioconst_pow10[FPIOCONST_POW10_ARRAY_SIZE]
      attribute_hidden;
 
 /* The constants in the array `_fpioconst_pow10' have an offset.  */