summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-27 01:26:31 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-27 01:26:31 +0000
commit9f5a468cf95779493ba6277083e59aa0c028c449 (patch)
tree01f97a5d91742ebbdfae5e68e5c59ffdf02ce18d /test/ruby
parent1dec75c02ffbb45f4494f285f5c20a8758cbd938 (diff)
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/trunk@58913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_float.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb
index 17e831812e..bddd10bf10 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))