diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-04 15:29:45 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-04 15:29:45 +0000 |
commit | 2072eccda17af1349ef13aa5194e80a5805b3bd3 (patch) | |
tree | a2626d4958c0eb6df0d3544e1e1a2e374b9ea25b /test | |
parent | 00992ff8d2da22ab3c005a082ff77cf974207081 (diff) |
merge revision(s) 58913: [Backport #13599]
numeric.c: fix for small number
* numeric.c (flo_floor, flo_ceil): should not return zero for small
number. [ruby-core:81394] [Bug #13599]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_float.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb index 7be9894a4b..fcff9fc7b8 100644 --- a/test/ruby/test_float.rb +++ b/test/ruby/test_float.rb @@ -457,6 +457,8 @@ class TestFloat < Test::Unit::TestCase end def test_floor_with_precision + assert_equal(+0.0, +0.001.floor(1)) + assert_equal(-0.1, -0.001.floor(1)) assert_equal(1.100, 1.111.floor(1)) assert_equal(1.110, 1.111.floor(2)) assert_equal(11110, 11119.9.floor(-1)) @@ -484,6 +486,8 @@ class TestFloat < Test::Unit::TestCase end def test_ceil_with_precision + assert_equal(+0.1, +0.001.ceil(1)) + assert_equal(-0.0, -0.001.ceil(1)) assert_equal(1.200, 1.111.ceil(1)) assert_equal(1.120, 1.111.ceil(2)) assert_equal(11120, 11111.1.ceil(-1)) |