diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-07-25 03:31:54 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-07-25 03:31:54 +0000 |
commit | deddf8092de80946261279dd9669a801c24aad81 (patch) | |
tree | baf9e282f473865d7d24d38434a1dadd2c138818 | |
parent | 15ef4b555f5bef9bbcb39bf72f8399d77e57afff (diff) | |
download | glibc-deddf8092de80946261279dd9669a801c24aad81.tar.gz glibc-deddf8092de80946261279dd9669a801c24aad81.tar.xz glibc-deddf8092de80946261279dd9669a801c24aad81.zip |
[BZ #274]
Update. 2004-07-21 Jakub Jelinek <jakub@redhat.com> [BZ #274] * stdlib/strtod_l.c (INTERNAL (__STRTOF)): Fix used >= BITS_PER_MP_LIMB shifting up. * stdlib/tst-strtod.c (main): Add new tests.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | stdlib/strtod_l.c | 2 | ||||
-rw-r--r-- | stdlib/tst-strtod.c | 15 |
3 files changed, 23 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index 2dcdb0d189..b3e966018d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-07-21 Jakub Jelinek <jakub@redhat.com> + + [BZ #274] + * stdlib/strtod_l.c (INTERNAL (__STRTOF)): Fix used >= + BITS_PER_MP_LIMB shifting up. + * stdlib/tst-strtod.c (main): Add new tests. + 2004-07-23 Jakub Jelinek <jakub@redhat.com> [BZ #282] diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c index 9eca802a10..dce65cb83c 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -1484,7 +1484,7 @@ INTERNAL (__STRTOF) (nptr, endptr, group, loc) / 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) diff --git a/stdlib/tst-strtod.c b/stdlib/tst-strtod.c index f9ab583ca0..628e40ca39 100644 --- a/stdlib/tst-strtod.c +++ b/stdlib/tst-strtod.c @@ -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 (); |