about summary refs log tree commit diff
path: root/stdio-common/printf_fphex.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-03-08 21:35:44 +0000
committerUlrich Drepper <drepper@redhat.com>1999-03-08 21:35:44 +0000
commit29329ef54739d84393b59058d83ba23e40ca88e9 (patch)
tree309887fa730b3e8deb550e5bec1f2aa946b533ab /stdio-common/printf_fphex.c
parent1d67062e53fe823c5b9f803b082cccef47e1e729 (diff)
downloadglibc-29329ef54739d84393b59058d83ba23e40ca88e9.tar.gz
glibc-29329ef54739d84393b59058d83ba23e40ca88e9.tar.xz
glibc-29329ef54739d84393b59058d83ba23e40ca88e9.zip
(__printf_fphex): Print no decimal point if the precision is zero, even if the mantissa is non-zero.
Diffstat (limited to 'stdio-common/printf_fphex.c')
-rw-r--r--stdio-common/printf_fphex.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c
index a959d55553..660435f6b3 100644
--- a/stdio-common/printf_fphex.c
+++ b/stdio-common/printf_fphex.c
@@ -412,9 +412,9 @@ __printf_fphex (FILE *fp,
 	    + ((expbuf + sizeof expbuf) - expstr));
 	    /* Exponent.  */
 
-  /* A special case if when the mantissa is zero and the `#' is not
-     given.  In this case we must not print the decimal point.  */
-  if (zero_mantissa && precision == 0 && !info->alt)
+  /* A special case when the mantissa or the precision is zero and the `#'
+     is not given.  In this case we must not print the decimal point.  */
+  if ((zero_mantissa || precision == 0) && !info->alt)
     ++width;		/* This nihilates the +1 for the decimal-point
 			   character in the following equation.  */
 
@@ -432,10 +432,10 @@ __printf_fphex (FILE *fp,
   outchar (info->spec == 'A' ? 'X' : 'x');
   outchar (leading);
 
-  if (!zero_mantissa || precision > 0 || info->alt)
+  if ((!zero_mantissa && precision > 0) || info->alt)
     outchar (decimal);
 
-  if (!zero_mantissa || precision > 0)
+  if (!zero_mantissa && precision > 0)
     {
       PRINT (numstr, MIN (numend - numstr, precision));
       if (precision > numend - numstr)