From e9240114a0e8114823c9d0227b4315f71349828c Mon Sep 17 00:00:00 2001 From: naruse Date: Wed, 20 Oct 2010 01:03:18 +0000 Subject: * vsnprintf.c (BSD_vfprintf): print floating point on "%#a". [ruby-dev:42431] Bug#3965 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vsnprintf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'vsnprintf.c') diff --git a/vsnprintf.c b/vsnprintf.c index 1f4172efb8..88a36a102e 100644 --- a/vsnprintf.c +++ b/vsnprintf.c @@ -784,7 +784,6 @@ reswitch: switch (ch) { #ifdef FLOATING_POINT case 'a': case 'A': - flags &= ~ALT; if (prec >= 0) prec++; goto fp_begin; @@ -832,7 +831,7 @@ fp_begin: _double = va_arg(ap, double); expsize = exponent(expstr, expt, ch + 'p' - 'a'); ch += 'x' - 'a'; size = expsize + ndig; - if (ndig > 1) + if (ndig > 1 || flags & ALT) ++size; /* floating point */ } else if (ch <= 'e') { /* 'e' or 'E' fmt */ @@ -1067,7 +1066,7 @@ long_len: ox[2] = *cp++; ox[3] = '.'; PRINT(ox+2, 2); - PRINT(cp, ndig-1); + if (ndig > 0) PRINT(cp, ndig-1); } else /* XpYYY */ PRINT(cp, 1); PRINT(expstr, expsize); @@ -1179,8 +1178,6 @@ cvt(value, ndigits, flags, sign, decpt, ch, length, buf) *decpt = -ndigits + 1; bp += *decpt; } - if (value == 0) /* kludge for __dtoa irregularity */ - rve = bp; while (rve < bp) *rve++ = '0'; } -- cgit v1.2.3