Fix fcvt to only show 'ndigit' past decimal

Even if the number is really small and this means showing *no* digits.
This makes newlib match glibc, and the fcvt posix man page.

Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Keith Packard 2019-12-18 08:49:05 -08:00 committed by Ken Brown
parent 85a3a81837
commit 233c16aa61
1 changed files with 1 additions and 8 deletions

View File

@ -235,14 +235,7 @@ fcvtbuf (double invalue,
save = fcvt_buf;
if (invalue < 1.0 && invalue > -1.0)
{
p = _dtoa_r (reent, invalue, 2, ndigit, decpt, sign, &end);
}
else
{
p = _dtoa_r (reent, invalue, 3, ndigit, decpt, sign, &end);
}
p = _dtoa_r (reent, invalue, 3, ndigit, decpt, sign, &end);
/* Now copy */