From 233c16aa615b882f7f4f0df8c67b2bdbb3f8a91b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Dec 2019 08:49:05 -0800 Subject: [PATCH] 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 --- newlib/libc/stdlib/ecvtbuf.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/newlib/libc/stdlib/ecvtbuf.c b/newlib/libc/stdlib/ecvtbuf.c index e3d7b55d8..12e8c9a92 100644 --- a/newlib/libc/stdlib/ecvtbuf.c +++ b/newlib/libc/stdlib/ecvtbuf.c @@ -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 */