]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(__printf_fphex): Don't ignore the precision if the mantissa is zero.
authorUlrich Drepper <drepper@redhat.com>
Mon, 7 Jun 1999 15:53:16 +0000 (15:53 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 7 Jun 1999 15:53:16 +0000 (15:53 +0000)
sysdeps/generic/printf_fphex.c

index 00dd8eed1d5e17a2ab746ac088db5160f6aabf9f..e6e6e2c2b5476b57779ebabc508f43fea497ec50 100644 (file)
@@ -405,7 +405,11 @@ __printf_fphex (FILE *fp,
        }
     }
   else
-    numend = numstr;
+    {
+      if (precision == -1)
+       precision = 0;
+      numend = numstr;
+    }
 
   /* Now we can compute the exponent string.  */
   expstr = _itoa_word (exponent, expbuf + sizeof expbuf, 10, 0);
@@ -420,7 +424,7 @@ __printf_fphex (FILE *fp,
 
   /* 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)
+  if (precision == 0 && !info->alt)
     ++width;           /* This nihilates the +1 for the decimal-point
                           character in the following equation.  */
 
@@ -438,10 +442,10 @@ __printf_fphex (FILE *fp,
   outchar (info->spec == 'A' ? 'X' : 'x');
   outchar (leading);
 
-  if ((!zero_mantissa && precision > 0) || info->alt)
+  if (precision > 0 || info->alt)
     outchar (decimal);
 
-  if (!zero_mantissa && precision > 0)
+  if (precision > 0)
     {
       PRINT (numstr, MIN (numend - numstr, precision));
       if (precision > numend - numstr)