From: Ulrich Drepper Date: Sun, 29 Jul 2007 00:26:28 +0000 (+0000) Subject: [BZ 4858] X-Git-Tag: cvs/fedora-glibc-20070731T1624~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f5e140031a944855846eb745c13e013c7b5539f;p=thirdparty%2Fglibc.git [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. --- diff --git a/ChangeLog b/ChangeLog index 15c5e840744..754eea77b3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-07-28 Ulrich Drepper + + [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-26 Jakub Jelinek * locale/programs/ld-monetary.c (monetary_finish): Avoid range check diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c index 6e5ff5855bd..ae25ab6fc52 100644 --- a/stdio-common/printf_fp.c +++ b/stdio-common/printf_fp.c @@ -986,7 +986,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 diff --git a/stdio-common/tfformat.c b/stdio-common/tfformat.c index d67b3b504d7..f9b5f7655b0 100644 --- a/stdio-common/tfformat.c +++ b/stdio-common/tfformat.c @@ -4024,6 +4024,9 @@ 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"}, + {0 } };