From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31793 invoked by alias); 20 Jul 2004 22:17:49 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 31777 invoked from network); 20 Jul 2004 22:17:49 -0000 Received: from unknown (HELO sunsite.ms.mff.cuni.cz) (195.113.15.26) by sourceware.org with SMTP; 20 Jul 2004 22:17:49 -0000 Received: from sunsite.ms.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8) with ESMTP id i6KK1r3j003095; Tue, 20 Jul 2004 22:01:53 +0200 Received: (from jakub@localhost) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8/Submit) id i6KK1qvS003093; Tue, 20 Jul 2004 22:01:52 +0200 Date: Tue, 20 Jul 2004 22:17:00 -0000 From: Jakub Jelinek To: Ulrich Drepper , Roland McGrath Cc: Glibc hackers Subject: [PATCH] Fix strtold on 32-bit arches with ldbl-96 [BZ #274] Message-ID: <20040720200152.GO30497@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2004-07/txt/msg00042.txt.bz2 Hi! This hunk is supposed to shift retval up by used bits where used >= BITS_PER_MP_LIMB, but it clears also the lowest limb already containing result of mpn_lshift. 2004-07-21 Jakub Jelinek [BZ #274] * stdlib/strtod_l.c (INTERNAL (__STRTOF)): Fix used >= BITS_PER_MP_LIMB shifting up. * stdlib/tst-strtod.c (main): Add new tests. --- libc/stdlib/strtod_l.c.jj 2004-07-12 20:47:47.000000000 +0200 +++ libc/stdlib/strtod_l.c 2004-07-20 23:49:29.456044788 +0200 @@ -1488,7 +1488,7 @@ / BITS_PER_MP_LIMB], retval, RETURN_LIMB_SIZE, used % BITS_PER_MP_LIMB); - for (i = used / BITS_PER_MP_LIMB; i >= 0; --i) + for (i = used / BITS_PER_MP_LIMB - 1; i >= 0; --i) retval[i] = 0; } else if (used > 0) --- libc/stdlib/tst-strtod.c.jj 2003-06-27 13:08:48.000000000 +0200 +++ libc/stdlib/tst-strtod.c 2004-07-21 00:02:05.378630841 +0200 @@ -157,6 +157,21 @@ main (int argc, char ** argv) status = 1; } + static struct { const char *str; long double l; } ltests[] = + { + { "42.0000000000000000001", 42.0000000000000000001L }, + { "42.00000000000000000001", 42.00000000000000000001L }, + { "42.000000000000000000001", 42.000000000000000000001L } + }; + int n; + for (n = 0; n < sizeof (ltests) / sizeof (ltests[0]); ++n) + if (strtold (ltests[n].str, NULL) != ltests[n].l) + { + printf ("ltests[%d]: %La != %La\n", n, + strtold (ltests[n].str, NULL), ltests[n].l); + status = 1; + } + status |= long_dbl (); status |= locale_test (); Jakub