mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 14:34:39 +02:00
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
This commit is contained in:
parent
528ef3ca93
commit
52b59fc9d9
3 changed files with 18 additions and 1 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue