mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* math.c (math_atanh): raise EDOM on FreeBSD when atanh(1).
* math.c (math_log): ditto. * math.c (math_log2): ditto. * math.c (math_log10): ditto. * test/ruby/test_math.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
54da95b9e1
commit
78b5fdd5a8
3 changed files with 39 additions and 3 deletions
|
@ -110,6 +110,7 @@ class TestMath < Test::Unit::TestCase
|
|||
check(0, Math.log(1, 10))
|
||||
check(1, Math.log(10, 10))
|
||||
check(2, Math.log(100, 10))
|
||||
assert_equal(1.0/0, Math.log(1.0/0))
|
||||
assert_raise(Errno::EDOM, Errno::ERANGE) { Math.log(0) }
|
||||
assert_raise(Errno::EDOM, Errno::ERANGE) { Math.log(-1) }
|
||||
end
|
||||
|
@ -118,6 +119,7 @@ class TestMath < Test::Unit::TestCase
|
|||
check(0, Math.log2(1))
|
||||
check(1, Math.log2(2))
|
||||
check(2, Math.log2(4))
|
||||
assert_equal(1.0/0, Math.log2(1.0/0))
|
||||
assert_raise(Errno::EDOM, Errno::ERANGE) { Math.log2(0) }
|
||||
assert_raise(Errno::EDOM, Errno::ERANGE) { Math.log2(-1) }
|
||||
end
|
||||
|
@ -126,6 +128,7 @@ class TestMath < Test::Unit::TestCase
|
|||
check(0, Math.log10(1))
|
||||
check(1, Math.log10(10))
|
||||
check(2, Math.log10(100))
|
||||
assert_equal(1.0/0, Math.log10(1.0/0))
|
||||
assert_raise(Errno::EDOM, Errno::ERANGE) { Math.log10(0) }
|
||||
assert_raise(Errno::EDOM, Errno::ERANGE) { Math.log10(-1) }
|
||||
end
|
||||
|
@ -134,6 +137,7 @@ class TestMath < Test::Unit::TestCase
|
|||
check(0, Math.sqrt(0))
|
||||
check(1, Math.sqrt(1))
|
||||
check(2, Math.sqrt(4))
|
||||
assert_equal(1.0/0, Math.sqrt(1.0/0))
|
||||
assert_raise(Errno::EDOM, Errno::ERANGE) { Math.sqrt(-1) }
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue