about summary refs log tree commit diff
path: root/stdlib/strtold.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/strtold.c')
-rw-r--r--stdlib/strtold.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/stdlib/strtold.c b/stdlib/strtold.c
index 1dc0ac37c2..9747232ef2 100644
--- a/stdlib/strtold.c
+++ b/stdlib/strtold.c
@@ -9,7 +9,9 @@
 #define SET_MANTISSA(flt, mant) \
   do { union ieee854_long_double u;					      \
        u.d = (flt);							      \
-       u.ieee.mantissa0 = ((mant) >> 32) & 0x7fffffff;			      \
+       if ((mant & 0x7fffffffffffffffULL) == 0)				      \
+	 mant = 0x4000000000000000ULL;					      \
+       u.ieee.mantissa0 = (((mant) >> 32) & 0x7fffffff) | 0x80000000;	      \
        u.ieee.mantissa1 = (mant) & 0xffffffff;				      \
        (flt) = u.d;							      \
   } while (0)