mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
math.c: check domain of base argument
* math.c (math_log): check domain of base argument too. raises Math::DomainError instead of returning NaN if the base is less than 0, and returns NaN instead of -infinity if both of two arguments are 0. [ruby-core:62309] [Bug #9797] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1fd4c7f1f5
commit
38656e24be
3 changed files with 26 additions and 8 deletions
|
@ -142,6 +142,8 @@ class TestMath < Test::Unit::TestCase
|
|||
assert_nothing_raised { assert_infinity(-Math.log(-0.0)) }
|
||||
assert_raise(Math::DomainError) { Math.log(-1.0) }
|
||||
assert_raise(TypeError) { Math.log(1,nil) }
|
||||
assert_raise(Math::DomainError, '[ruby-core:62309] [ruby-Bug #9797]') { Math.log(1.0, -1.0) }
|
||||
assert_nothing_raised { assert_nan(Math.log(0.0, 0.0)) }
|
||||
end
|
||||
|
||||
def test_log2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue