about summary refs log tree commit diff
path: root/stdio-common/printf_fp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-07-29 00:26:28 +0000
committerUlrich Drepper <drepper@redhat.com>2007-07-29 00:26:28 +0000
commit8f5e140031a944855846eb745c13e013c7b5539f (patch)
treeebf93fde53644a22e996f859192d2ce81d87c995 /stdio-common/printf_fp.c
parentcedb4109571cff4416235df260848de77f09f556 (diff)
downloadglibc-8f5e140031a944855846eb745c13e013c7b5539f.tar.gz
glibc-8f5e140031a944855846eb745c13e013c7b5539f.tar.xz
glibc-8f5e140031a944855846eb745c13e013c7b5539f.zip
[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.
Diffstat (limited to 'stdio-common/printf_fp.c')
-rw-r--r--stdio-common/printf_fp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 6e5ff5855b..ae25ab6fc5 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