diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-07-10 05:27:27 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-07-10 05:27:27 +0000 |
commit | 295f60b94d5ff6551fab7c55e18d1ffa6a4cf7e3 (patch) | |
tree | b8f7a15df7947c84aefedad4af07460dc5399b7a /test/ruby | |
parent | 38ea561319864fecf92bc61af0d9b9b1f49df6a0 (diff) | |
download | ruby-295f60b94d5ff6551fab7c55e18d1ffa6a4cf7e3.tar.gz |
util.c: round nearly middle value
* util.c (ruby_dtoa): [EXPERIMENTAL] adjust the case that the
Float value is close to the exact but unrepresentable middle
value of two values in the given precision, as r55604.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_sprintf.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb index 5732cecbf9..440cd1d6ab 100644 --- a/test/ruby/test_sprintf.rb +++ b/test/ruby/test_sprintf.rb @@ -282,6 +282,10 @@ class TestSprintf < Test::Unit::TestCase assert_equal(" 0x1.000p+0", sprintf("%20.3a", 1), bug3979) end + def test_float_prec + assert_equal("5.03", sprintf("%.2f",5.025)) + end + BSIZ = 120 def test_skip |