(__printf_fphex): Print no decimal point if the precision is zero, even if the mantissa is non-zero.
This commit is contained in:
parent
1d67062e53
commit
29329ef547
|
@ -412,9 +412,9 @@ __printf_fphex (FILE *fp,
|
||||||
+ ((expbuf + sizeof expbuf) - expstr));
|
+ ((expbuf + sizeof expbuf) - expstr));
|
||||||
/* Exponent. */
|
/* Exponent. */
|
||||||
|
|
||||||
/* A special case if when the mantissa is zero and the `#' is not
|
/* A special case when the mantissa or the precision is zero and the `#'
|
||||||
given. In this case we must not print the decimal point. */
|
is not given. In this case we must not print the decimal point. */
|
||||||
if (zero_mantissa && precision == 0 && !info->alt)
|
if ((zero_mantissa || precision == 0) && !info->alt)
|
||||||
++width; /* This nihilates the +1 for the decimal-point
|
++width; /* This nihilates the +1 for the decimal-point
|
||||||
character in the following equation. */
|
character in the following equation. */
|
||||||
|
|
||||||
|
@ -432,10 +432,10 @@ __printf_fphex (FILE *fp,
|
||||||
outchar (info->spec == 'A' ? 'X' : 'x');
|
outchar (info->spec == 'A' ? 'X' : 'x');
|
||||||
outchar (leading);
|
outchar (leading);
|
||||||
|
|
||||||
if (!zero_mantissa || precision > 0 || info->alt)
|
if ((!zero_mantissa && precision > 0) || info->alt)
|
||||||
outchar (decimal);
|
outchar (decimal);
|
||||||
|
|
||||||
if (!zero_mantissa || precision > 0)
|
if (!zero_mantissa && precision > 0)
|
||||||
{
|
{
|
||||||
PRINT (numstr, MIN (numend - numstr, precision));
|
PRINT (numstr, MIN (numend - numstr, precision));
|
||||||
if (precision > numend - numstr)
|
if (precision > numend - numstr)
|
||||||
|
|
Loading…
Reference in New Issue