mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* sprintf.c (BSD_vfprintf): wrong padding arround prefix and
floating point with %a. [ruby-dev:42403] Bug #3956 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d41305b393
commit
a7e8b12f96
3 changed files with 15 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Mon Oct 18 09:57:28 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* sprintf.c (BSD_vfprintf): wrong padding arround prefix and
|
||||||
|
floating point with %a. [ruby-dev:42403] Bug #3956
|
||||||
|
|
||||||
Sun Oct 17 22:36:33 2010 Tadayoshi Funaba <tadf@dotrb.org>
|
Sun Oct 17 22:36:33 2010 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
* lib/date/delta.rb: added an rdoc tag.
|
* lib/date/delta.rb: added an rdoc tag.
|
||||||
|
|
|
@ -204,6 +204,13 @@ class TestSprintf < Test::Unit::TestCase
|
||||||
assert_equal("Inf", sprintf("%E", Float::INFINITY))
|
assert_equal("Inf", sprintf("%E", Float::INFINITY))
|
||||||
assert_equal("NaN", sprintf("%e", Float::NAN))
|
assert_equal("NaN", sprintf("%e", Float::NAN))
|
||||||
assert_equal("NaN", sprintf("%E", Float::NAN))
|
assert_equal("NaN", sprintf("%E", Float::NAN))
|
||||||
|
|
||||||
|
assert_equal(" -0x1p+0", sprintf("%10a", -1))
|
||||||
|
assert_equal(" -0x1.8p+0", sprintf("%10a", -1.5))
|
||||||
|
assert_equal(" -0x1.4p+0", sprintf("%10a", -1.25))
|
||||||
|
assert_equal(" -0x1.2p+0", sprintf("%10a", -1.125))
|
||||||
|
assert_equal(" -0x1.1p+0", sprintf("%10a", -1.0625))
|
||||||
|
assert_equal("-0x1.05p+0", sprintf("%10a", -1.03125))
|
||||||
end
|
end
|
||||||
|
|
||||||
BSIZ = 120
|
BSIZ = 120
|
||||||
|
|
|
@ -829,6 +829,9 @@ fp_begin: _double = va_arg(ap, double);
|
||||||
--expt;
|
--expt;
|
||||||
expsize = exponent(expstr, expt, ch + 'p' - 'a');
|
expsize = exponent(expstr, expt, ch + 'p' - 'a');
|
||||||
size = expsize + ndig;
|
size = expsize + ndig;
|
||||||
|
size += 2; /* 0x */
|
||||||
|
if (ndig > 1)
|
||||||
|
++size; /* floating point */
|
||||||
}
|
}
|
||||||
else if (ch <= 'e') { /* 'e' or 'E' fmt */
|
else if (ch <= 'e') { /* 'e' or 'E' fmt */
|
||||||
--expt;
|
--expt;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue