[BZ #15522] strtod ("nan(N)") returning a sNaN in some cases
[platform/upstream/glibc.git] / sysdeps / ieee754 / ldbl-128ibm / strtold_l.c
index 8799df8..04e3288 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2013 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -44,11 +44,10 @@ libc_hidden_proto (STRTOF)
 # define SET_MANTISSA(flt, mant) \
   do { union ibm_extended_long_double u;                                     \
        u.d = (flt);                                                          \
-       if ((mant & 0xfffffffffffffULL) == 0)                                 \
-        mant = 0x8000000000000ULL;                                           \
-       u.ieee.mantissa0 = ((mant) >> 32) & 0xfffff;                          \
-       u.ieee.mantissa1 = (mant) & 0xffffffff;                               \
-       (flt) = u.d;                                                          \
+       u.ieee_nan.mantissa0 = (mant) >> 32;                                  \
+       u.ieee_nan.mantissa1 = (mant);                                        \
+       if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0)                       \
+        (flt) = u.d;                                                         \
   } while (0)
 
 #include <strtod_l.c>