]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Partially revert 681900d29683722b1cb0a8e565a0585846ec5a61
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Tue, 15 Dec 2020 10:36:48 +0000 (16:06 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Thu, 24 Dec 2020 00:35:46 +0000 (06:05 +0530)
Do not attempt to fix the significand top bit in long double input
received in printf.  The code should never reach here because isnan
should now detect unnormals as NaN.  This is already a NOP for glibc
since it uses the gcc __builtin_isnan, which detects unnormals as NaN.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
sysdeps/x86/ldbl2mpn.c
sysdeps/x86/tst-ldbl-nonnormal-printf.c

index 23afedfb67bef076b29e9bc7a73a7dada57cb47f..ec8464eef7a32ac79ae3b01395f7d86fd28b2df0 100644 (file)
@@ -115,14 +115,6 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
           && res_ptr[N - 1] == 0)
     /* Pseudo zero.  */
     *expt = 0;
-  else
-    /* Unlike other floating point formats, the most significant bit
-       is explicit and expected to be set for normal numbers.  Set it
-       in case it is cleared in the input.  Otherwise, callers will
-       not be able to produce the expected multi-precision integer
-       layout by shifting.  */
-    res_ptr[N - 1] |= (mp_limb_t) 1 << (LDBL_MANT_DIG - 1
-                                       - ((N - 1) * BITS_PER_MP_LIMB));
 
   return N;
 }
index 54381ece0b3b742f4aa05110f7269bcb5301a8fc..2b513960a77a99de8b69cd032007e973707456c8 100644 (file)
@@ -42,10 +42,7 @@ do_test (void)
   char buf[30];
   int ret = snprintf (buf, sizeof (buf), "%Lg", value);
   TEST_COMPARE (ret, strlen (buf));
-  if (strcmp (buf, "nan") != 0)
-    /* If snprintf does not recognize the non-normal number as a NaN,
-       it has added the missing explicit MSB.  */
-    TEST_COMPARE_STRING (buf, "3.02201e-4624");
+  TEST_COMPARE_STRING (buf, "nan");
   return 0;
 }