Skip to content

Commit

Permalink
[BZ 4858]
Browse files Browse the repository at this point in the history
	* 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.
  • Loading branch information
Ulrich Drepper committed Jul 29, 2007
1 parent cedb410 commit 8f5e140
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
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-26 Jakub Jelinek <jakub@redhat.com>

* locale/programs/ld-monetary.c (monetary_finish): Avoid range check
Expand Down
4 changes: 3 additions & 1 deletion stdio-common/printf_fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions stdio-common/tfformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

};
Expand Down

0 comments on commit 8f5e140

Please sign in to comment.