diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-20 01:03:18 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-20 01:03:18 +0000 |
commit | e9240114a0e8114823c9d0227b4315f71349828c (patch) | |
tree | 3fd21858916d79bcf25883e1330d508bef8a48a9 /vsnprintf.c | |
parent | fb796561f0b601148c7b242ad1a3e847ef60e3c9 (diff) |
* 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
Diffstat (limited to 'vsnprintf.c')
-rw-r--r-- | vsnprintf.c | 7 |
1 files changed, 2 insertions, 5 deletions
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'; } |