1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vsnprintf.c (BSD_vfprintf): don't output floating point

when the precision is 0. [ruby-dev:42615]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2010-11-22 16:06:38 +00:00
parent 94e6c0c233
commit 18c0fc890c
3 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Tue Nov 23 01:05:27 2010 NARUSE, Yui <naruse@ruby-lang.org>
* vsnprintf.c (BSD_vfprintf): don't output floating point
when the precision is 0. [ruby-dev:42615]
Mon Nov 22 21:30:57 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* string.c (rb_str_inspect): fix for ascii-compatible external

View file

@ -190,7 +190,7 @@ class TestSprintf < Test::Unit::TestCase
sprintf("%20.0f", 36893488147419107329.0))
assert_equal(" Inf", sprintf("% 0e", 1.0/0.0), "moved from btest/knownbug")
assert_equal(" -0.", sprintf("%#10.0f", -0.5), "[ruby-dev:42552]")
assert_equal("0x1.p+2", sprintf('%.0a', Float('0x1.fp+1')), "[ruby-dev:42551]")
assert_equal("0x1p+2", sprintf('%.0a', Float('0x1.fp+1')), "[ruby-dev:42551]")
assert_equal("-0x1.0p+2", sprintf('%.1a', Float('-0x1.ffp+1')), "[ruby-dev:42551]")
end

View file

@ -790,7 +790,7 @@ reswitch: switch (ch) {
#ifdef FLOATING_POINT
case 'a':
case 'A':
if (prec >= 0) {
if (prec > 0) {
flags |= ALT;
prec++;
}