about summary refs log tree commit diff
path: root/stdlib/strtod.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/strtod.c')
-rw-r--r--stdlib/strtod.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/stdlib/strtod.c b/stdlib/strtod.c
index 760ecd26a7..e0c9b08031 100644
--- a/stdlib/strtod.c
+++ b/stdlib/strtod.c
@@ -34,6 +34,8 @@
 # define SET_MANTISSA(flt, mant) \
   do { union ieee754_double u;						      \
        u.d = (flt);							      \
+       if ((mant & 0xfffffffffffffULL) == 0)				      \
+	 mant = 0x8000000000000ULL;					      \
        u.ieee.mantissa0 = ((mant) >> 32) & 0xfffff;			      \
        u.ieee.mantissa1 = (mant) & 0xffffffff;				      \
   } while (0)
@@ -627,7 +629,8 @@ INTERNAL (STRTOF) (nptr, endptr, group)
   expp = cp;
 
   /* Read exponent.  */
-  if (TOLOWER (c) == (base == 16 ? L_('p') : L_('e')))
+  if ((base == 16 && TOLOWER (c) == L_('p'))
+      || (base != 16 && TOLOWER (c) == L_('e')))
     {
       int exp_negative = 0;