summaryrefslogtreecommitdiff
path: root/stdlib/tst-strtod.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-06-17 23:38:21 +0000
committerUlrich Drepper <drepper@redhat.com>1998-06-17 23:38:21 +0000
commit46827b5cdec911f5c267b780d044086ee602097b (patch)
treedc763e3dd5c0bc0ddd9bd357b434e98272d4c338 /stdlib/tst-strtod.c
parent779515aff97b8ccdb0617cc085fddcb2763ddc0d (diff)
Update.
* stdlib/tst-strtod.c (long_dbl): Add test for loooong numbers.
Diffstat (limited to 'stdlib/tst-strtod.c')
-rw-r--r--stdlib/tst-strtod.c24
1 files changed, 23 insertions, 1 deletions
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;
+}