diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | stdlib/tst-strtod.c | 24 |
2 files changed, 25 insertions, 1 deletions
@@ -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. diff --git a/stdlib/tst-strtod.c b/stdlib/tst-strtod.c index bfc2481..e2c6734 100644 --- a/stdlib/tst-strtod.c +++ b/stdlib/tst-strtod.c @@ -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; +} |