* stdlib/tst-strtod.c (long_dbl): Add test for loooong numbers.
This commit is contained in:
Ulrich Drepper 1998-06-17 23:38:21 +00:00
parent 779515aff9
commit 46827b5cde
2 changed files with 25 additions and 1 deletions

View File

@ -1,5 +1,7 @@
1998-06-17 Ulrich Drepper <drepper@cygnus.com>
* stdlib/tst-strtod.c (long_dbl): Add test for loooong numbers.
* stdlib/strtod.c (str_to_mpn): Fix extending of n array which
only should happen for cy != 0.

View File

@ -42,7 +42,8 @@ static const struct ltest tests[] =
{ NULL, 0, '\0', 0 }
};
static void expand __P ((char *dst, int c));
static void expand (char *dst, int c);
static int long_dbl (void);
int
main (int argc, char ** argv)
@ -91,6 +92,8 @@ main (int argc, char ** argv)
status = 1;
}
status |= long_dbl ();
exit (status ? EXIT_FAILURE : EXIT_SUCCESS);
}
@ -107,3 +110,22 @@ expand (dst, c)
else
(void) sprintf (dst, "%#.3o", (unsigned int) c);
}
static int
long_dbl (void)
{
const char longestdbl[] =
"179769313486231570814527423731704356798070567525844996598917476"
"803157260780028538760589558632766878171540458953514382464234321"
"326889464182768467546703537516986049910576551282076245490090389"
"328944075868508455133942304583236903222948165808559332123348274"
"797826204144723168738177180919299881250404026184124858368";
double d = strtod (longestdbl, NULL);
printf ("strtod (\"%s\", NULL) = %g\n", longestdbl, d);
if (d != 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000)
return 1;
return 0;
}