about summary refs log tree commit diff
path: root/wcsmbs/wcstold.c
diff options
context:
space:
mode:
Diffstat (limited to 'wcsmbs/wcstold.c')
-rw-r--r--wcsmbs/wcstold.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/wcsmbs/wcstold.c b/wcsmbs/wcstold.c
index c94d47ea4f..1a3f0d2c6e 100644
--- a/wcsmbs/wcstold.c
+++ b/wcsmbs/wcstold.c
@@ -30,7 +30,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)