diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2013-05-23 18:00:10 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2013-08-29 12:22:10 +0200 |
commit | 0007fc9bdd1d9efcd52d07837f2cd085b5a8f58b (patch) | |
tree | b3c86dbee5b95c24a8413be634ae11318ceb2f8e /stdlib/tst-strtod6.c | |
parent | f1cc4c8654b6bc431273286d3562942c50975caf (diff) | |
download | glibc-0007fc9bdd1d9efcd52d07837f2cd085b5a8f58b.tar glibc-0007fc9bdd1d9efcd52d07837f2cd085b5a8f58b.tar.gz glibc-0007fc9bdd1d9efcd52d07837f2cd085b5a8f58b.tar.bz2 glibc-0007fc9bdd1d9efcd52d07837f2cd085b5a8f58b.zip |
[BZ #15522] strtod ("nan(N)") returning a sNaN in some cases
Diffstat (limited to 'stdlib/tst-strtod6.c')
-rw-r--r-- | stdlib/tst-strtod6.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/stdlib/tst-strtod6.c b/stdlib/tst-strtod6.c index 1d87266a27..15e79fddfb 100644 --- a/stdlib/tst-strtod6.c +++ b/stdlib/tst-strtod6.c @@ -4,12 +4,13 @@ #include <string.h> static int -do_test (void) +test (const char str[]) { - static const char str[] = "NaN(blabla)something"; char *endp; int result = 0; + puts (str); + double d = strtod (str, &endp); if (!isnan (d)) { @@ -64,5 +65,24 @@ do_test (void) return result; } +static int +do_test (void) +{ + int result = 0; + + result |= test ("NaN(blabla)something"); + result |= test ("NaN(1234)something"); + /* UINT32_MAX. */ + result |= test ("NaN(4294967295)something"); + /* UINT64_MAX. */ + result |= test ("NaN(18446744073709551615)something"); + /* The case of zero is special in that "something" has to be done to make the + mantissa different from zero, which would mean infinity instead of + NaN. */ + result |= test ("NaN(0)something"); + + return result; +} + #define TEST_FUNCTION do_test () #include "../test-skeleton.c" |