public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] Partially revert 681900d29683722b1cb0a8e565a0585846ec5a61
@ 2020-12-24  0:37 Siddhesh Poyarekar
  0 siblings, 0 replies; only message in thread
From: Siddhesh Poyarekar @ 2020-12-24  0:37 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=41290b6e842a2adfbda77a49abfacb0db2d63bfb

commit 41290b6e842a2adfbda77a49abfacb0db2d63bfb
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Tue Dec 15 16:06:48 2020 +0530

    Partially revert 681900d29683722b1cb0a8e565a0585846ec5a61
    
    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>

Diff:
---
 sysdeps/x86/ldbl2mpn.c                  | 8 --------
 sysdeps/x86/tst-ldbl-nonnormal-printf.c | 5 +----
 2 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/sysdeps/x86/ldbl2mpn.c b/sysdeps/x86/ldbl2mpn.c
index 23afedfb67..ec8464eef7 100644
--- a/sysdeps/x86/ldbl2mpn.c
+++ b/sysdeps/x86/ldbl2mpn.c
@@ -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;
 }
diff --git a/sysdeps/x86/tst-ldbl-nonnormal-printf.c b/sysdeps/x86/tst-ldbl-nonnormal-printf.c
index 54381ece0b..2b513960a7 100644
--- a/sysdeps/x86/tst-ldbl-nonnormal-printf.c
+++ b/sysdeps/x86/tst-ldbl-nonnormal-printf.c
@@ -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;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-24  0:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-24  0:37 [glibc] Partially revert 681900d29683722b1cb0a8e565a0585846ec5a61 Siddhesh Poyarekar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).