diff options
Diffstat (limited to 'wcsmbs')
-rw-r--r-- | wcsmbs/wcstof.c | 2 | ||||
-rw-r--r-- | wcsmbs/wcstold.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/wcsmbs/wcstof.c b/wcsmbs/wcstof.c index ef1448b096..f410e4cf32 100644 --- a/wcsmbs/wcstof.c +++ b/wcsmbs/wcstof.c @@ -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) 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) |