1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

[BZ #15522] strtod ("nan(N)") returning a sNaN in some cases

This commit is contained in:
Thomas Schwinge
2013-05-23 18:00:10 +02:00
parent f1cc4c8654
commit 0007fc9bdd
10 changed files with 87 additions and 32 deletions

View File

@ -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"