aboutsummaryrefslogtreecommitdiff
path: root/stdio-common
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/printf_fp.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index b8813aa35d..e746101ddf 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -212,8 +212,7 @@ __printf_fp (FILE *fp,
else if (scalesize == 0)
{
hi = frac[fracsize - 1];
- cy = __mpn_mul_1 (frac, frac, fracsize - 1, 10);
- frac[fracsize - 1] = cy;
+ frac[fracsize - 1] = __mpn_mul_1 (frac, frac, fracsize - 1, 10);
}
else
{
@@ -237,9 +236,9 @@ __printf_fp (FILE *fp,
}
}
- cy = __mpn_mul_1 (frac, frac, fracsize, 10);
- if (cy != 0)
- frac[fracsize++] = cy;
+ mp_limb_t _cy = __mpn_mul_1 (frac, frac, fracsize, 10);
+ if (_cy != 0)
+ frac[fracsize++] = _cy;
}
return L'0' + hi;
@@ -364,6 +363,7 @@ __printf_fp (FILE *fp,
/* Check for special values: not a number or infinity. */
if (__isnan (fpnum.dbl))
{
+ is_neg = 0;
if (isupper (info->spec))
{
special = "NAN";
@@ -374,10 +374,10 @@ __printf_fp (FILE *fp,
special = "nan";
wspecial = L"nan";
}
- is_neg = 0;
}
else if (__isinf (fpnum.dbl))
{
+ is_neg = fpnum.dbl < 0;
if (isupper (info->spec))
{
special = "INF";
@@ -388,7 +388,6 @@ __printf_fp (FILE *fp,
special = "inf";
wspecial = L"inf";
}
- is_neg = fpnum.dbl < 0;
}
else
{
@@ -814,6 +813,8 @@ __printf_fp (FILE *fp,
{
type = 'f';
fracdig_min = fracdig_max = info->prec < 0 ? 6 : info->prec;
+ dig_max = INT_MAX; /* Unlimited. */
+ significant = 1; /* Does not matter here. */
if (expsign == 0)
{
intdig_max = exponent + 1;
@@ -825,8 +826,6 @@ __printf_fp (FILE *fp,
intdig_max = 1;
chars_needed = 1 + 1 + fracdig_max;
}
- dig_max = INT_MAX; /* Unlimited. */
- significant = 1; /* Does not matter here. */
}
else
{
@@ -912,7 +911,7 @@ __printf_fp (FILE *fp,
{
++fracdig_no;
*wcp = hack_digit ();
- if (*wcp != L'0')
+ if (*wcp++ != L'0')
significant = 1;
else if (significant == 0)
{
@@ -920,7 +919,6 @@ __printf_fp (FILE *fp,
if (fracdig_min > 0)
++fracdig_min;
}
- ++wcp;
}
/* Do rounding. */