]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
2007-07-31 Jakub Jelinek <jakub@redhat.com>
authorJakub Jelinek <jakub@redhat.com>
Tue, 31 Jul 2007 12:44:28 +0000 (12:44 +0000)
committerJakub Jelinek <jakub@redhat.com>
Tue, 31 Jul 2007 12:44:28 +0000 (12:44 +0000)
* stdio-common/tfformat.c (sprint_doubles): Add 12 new tests.

2007-07-28  Ulrich Drepper  <drepper@redhat.com>

[BZ #4858]
* stdio-common/printf_fp.c (___printf_fp): Fix special case of
#.0g and value rounded to 1.0.
* stdio-common/tfformat.c (sprint_doubles): Add two new tests.

ChangeLog
stdio-common/printf_fp.c
stdio-common/tfformat.c

index fbf5f1be2da2efa1a17488b1b66a43804dd60faa..365bb59f0747795082e9f4ec214d2a99ab397098 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-07-31  Jakub Jelinek  <jakub@redhat.com>
+
+       * stdio-common/tfformat.c (sprint_doubles): Add 12 new tests.
+
+2007-07-28  Ulrich Drepper  <drepper@redhat.com>
+
+       [BZ #4858]
+       * stdio-common/printf_fp.c (___printf_fp): Fix special case of
+       #.0g and value rounded to 1.0.
+       * stdio-common/tfformat.c (sprint_doubles): Add two new tests.
+
 2007-07-03  Jakub Jelinek  <jakub@redhat.com>
 
        [BZ #4702]
index c7a381a69d22cd77fba256d56aed9920dcafdb16..b48b6896614b347eb5b6d9c81b5b5979caa7ba3e 100644 (file)
@@ -985,7 +985,9 @@ ___printf_fp (FILE *fp,
            if (*wtp != decimalwc)
              /* Round up.  */
              (*wtp)++;
-           else if (__builtin_expect (spec == 'g' && type == 'f' && info->alt,
+           else if (__builtin_expect (spec == 'g' && type == 'f' && info->alt
+                                      && wtp == wstartp + 1
+                                      && wstartp[0] == L'0',
                                       0))
              /* This is a special case: the rounded number is 1.0,
                 the format is 'g' or 'G', and the alternative format
index d67b3b504d7d6e876279379f27a2f7eb43ffa705..7704ddde39856221f55b38169f53e3a2f20c87c6 100644 (file)
@@ -4024,6 +4024,21 @@ sprint_double_type sprint_doubles[] =
   {__LINE__, 1.0,                      "1.000000e+00", "%e"},
   {__LINE__, .9999999999999999,                "1.000000e+00", "%e"},
 
+  {__LINE__, 912.98,                   "913.0", "%#.4g"},
+  {__LINE__, 50.999999,                        "51.000", "%#.5g"},
+  {__LINE__, 0.956,                    "1", "%.1g"},
+  {__LINE__, 0.956,                    "1.", "%#.1g"},
+  {__LINE__, 0.996,                    "1", "%.2g"},
+  {__LINE__, 0.996,                    "1.0", "%#.2g"},
+  {__LINE__, 999.98,                   "1000", "%.4g"},
+  {__LINE__, 999.98,                   "1000.", "%#.4g"},
+  {__LINE__, 999.998,                  "1000", "%.5g"},
+  {__LINE__, 999.998,                  "1000.0", "%#.5g"},
+  {__LINE__, 999.9998,                 "1000", "%g"},
+  {__LINE__, 999.9998,                 "1000.00", "%#g"},
+  {__LINE__, 912.98,                   "913", "%.4g"},
+  {__LINE__, 50.999999,                        "51", "%.5g"},
+
   {0 }
 
 };