mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
fb796561f0
commit
e9240114a0
3 changed files with 14 additions and 7 deletions
|
@ -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';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue