summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-01 07:35:48 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-01 07:35:48 +0000
commit52b59fc9d90e8b06aa1e8df83c5ca63164769bcc (patch)
treeeff1ec9c0436e1ec426b046e770d0e1c065047bf /test
parent528ef3ca933b7cbbbd2e7dde8b1863bbed91947c (diff)
numeric.c: 0 % Float::NAN returns Float::NAN
* numeric.c (flodivmod): all results are NaN if divisor is NaN. [fix GH-692] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_float.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb
index 099f9e3b10..30725e8395 100644
--- a/test/ruby/test_float.rb
+++ b/test/ruby/test_float.rb
@@ -271,6 +271,12 @@ class TestFloat < Test::Unit::TestCase
assert_raise(ZeroDivisionError, bug6048) { 42 % 0 }
end
+ def test_modulo4
+ assert_predicate((0.0).modulo(Float::NAN), :nan?)
+ assert_predicate((1.0).modulo(Float::NAN), :nan?)
+ assert_predicate(Float::INFINITY.modulo(1), :nan?)
+ end
+
def test_divmod2
assert_equal([1.0, 0.0], 2.0.divmod(2))
assert_equal([1.0, 0.0], 2.0.divmod((2**32).coerce(2).first))