about summary refs log tree commit diff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-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;
+}