From e7d4f4404cb357179f83e9dfbacfe330289fa84d Mon Sep 17 00:00:00 2001 From: bde Date: Thu, 6 Apr 1995 16:28:15 +0000 Subject: Obtained from: 1.1.5 (originally by jtc) Fix printf("%g", 0.0) - print "0", not "0.". The previous fixes in this area had one non-cosmetic (non-)change that caused this bug. Bruce --- lib/libc/stdio/vfprintf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/libc/stdio/vfprintf.c') diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c index dc2769e..94e65cd 100644 --- a/lib/libc/stdio/vfprintf.c +++ b/lib/libc/stdio/vfprintf.c @@ -730,7 +730,8 @@ number: if ((dprec = prec) >= 0) if (ch >= 'f') { /* 'f' or 'g' */ if (_double == 0) { /* kludge for __dtoa irregularity */ - if (prec == 0 && (flags & ALT) == 0) { + if (expt >= ndig && + (flags & ALT) == 0) { PRINT("0", 1); } else { PRINT("0.", 2); -- cgit v1.1