From 46827b5cdec911f5c267b780d044086ee602097b Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 17 Jun 1998 23:38:21 +0000 Subject: [PATCH] Update. * stdlib/tst-strtod.c (long_dbl): Add test for loooong numbers. --- ChangeLog | 2 ++ stdlib/tst-strtod.c | 24 +++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5a1670e878..e011546b73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 1998-06-17 Ulrich Drepper + * 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 bfc2481589..e2c6734e56 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; +}