about summary refs log tree commit diff
path: root/stdio-common/tfformat.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common/tfformat.c')
-rw-r--r--stdio-common/tfformat.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/stdio-common/tfformat.c b/stdio-common/tfformat.c
index 02230f11ba..60785d803f 100644
--- a/stdio-common/tfformat.c
+++ b/stdio-common/tfformat.c
@@ -10,7 +10,7 @@ typedef struct
   const char *format_string;
 } sprint_double_type;
 
-sprint_double_type sprint_doubles[] = 
+sprint_double_type sprint_doubles[] =
 {
 __LINE__,  30.3,			"<          +30.3>", "<%+15.10g>",
 __LINE__,  10.0,			"<10.00>", "<%5.2f>",
@@ -4071,6 +4071,23 @@ int main()
       testcount++;
     }
 
+  /* And one special test.  */
+  {
+    const char ref[] = "1.7763568394002504646778106689453125e-15";
+    int i;
+    d = 1.0;
+    for (i = 1; i < 50; ++i)
+      d /= 2;
+    sprintf (buffer, "%.100g", d);
+    if (!matches (buffer, ref))
+      {
+	++errcount;
+	printf (
+    "Error in line %d using \"%s\".  Result is \"%s\"; should be: \"%s\".\n",
+		__LINE__, "%.100g", buffer, ref);
+      }
+  }
+
   if (errcount == 0)
     {
       printf("Encountered no errors in %d tests.\n", testcount);