summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vfprintf.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1995-04-06 16:28:15 +0000
committerbde <bde@FreeBSD.org>1995-04-06 16:28:15 +0000
commite7d4f4404cb357179f83e9dfbacfe330289fa84d (patch)
tree9350cd95bb4cb11fd271e61303df9bedcffc32a1 /lib/libc/stdio/vfprintf.c
parent9029dfd96c98cf80114b7029052832fe535be475 (diff)
downloadFreeBSD-src-e7d4f4404cb357179f83e9dfbacfe330289fa84d.zip
FreeBSD-src-e7d4f4404cb357179f83e9dfbacfe330289fa84d.tar.gz
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
Diffstat (limited to 'lib/libc/stdio/vfprintf.c')
-rw-r--r--lib/libc/stdio/vfprintf.c3
1 files changed, 2 insertions, 1 deletions
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);
OpenPOWER on IntegriCloud