(SET_MANTISSA): Make sure that at least one bit is set in mantissa.
authordrepper <drepper>
Wed, 2 Apr 1997 14:41:55 +0000 (14:41 +0000)
committerdrepper <drepper>
Wed, 2 Apr 1997 14:41:55 +0000 (14:41 +0000)
wcsmbs/wcstof.c
wcsmbs/wcstold.c

index ef1448b..f410e4c 100644 (file)
@@ -30,6 +30,8 @@
 #define SET_MANTISSA(flt, mant) \
   do { union ieee754_float u;                                                \
        u.f = (flt);                                                          \
+       if ((mant & 0x7fffff) == 0)                                           \
+        mant = 0x400000;                                                     \
        u.ieee.mantissa = (mant) & 0x7fffff;                                  \
        (flt) = u.f;                                                          \
   } while (0)
index c94d47e..1a3f0d2 100644 (file)
@@ -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)