mirror of
https://github.com/ruby/ruby.git
synced 2025-09-20 02:53:57 +02:00
math.c: fix for Bignum argument
* math.c (math_log, math_log2, math_log10): fix for Bignum argument. numbits should be add only when right shifted. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f450dede0e
commit
202cc8e615
3 changed files with 20 additions and 3 deletions
|
@ -136,6 +136,7 @@ class TestMath < Test::Unit::TestCase
|
|||
check(0, Math.log(1, 10))
|
||||
check(1, Math.log(10, 10))
|
||||
check(2, Math.log(100, 10))
|
||||
check(Math.log(2.0 ** 64), Math.log(1 << 64))
|
||||
assert_equal(1.0/0, Math.log(1.0/0))
|
||||
assert_nothing_raised { assert_infinity(-Math.log(+0.0)) }
|
||||
assert_nothing_raised { assert_infinity(-Math.log(-0.0)) }
|
||||
|
@ -147,6 +148,7 @@ class TestMath < Test::Unit::TestCase
|
|||
check(0, Math.log2(1))
|
||||
check(1, Math.log2(2))
|
||||
check(2, Math.log2(4))
|
||||
check(Math.log2(2.0 ** 64), Math.log2(1 << 64))
|
||||
assert_equal(1.0/0, Math.log2(1.0/0))
|
||||
assert_nothing_raised { assert_infinity(-Math.log2(+0.0)) }
|
||||
assert_nothing_raised { assert_infinity(-Math.log2(-0.0)) }
|
||||
|
@ -157,6 +159,7 @@ class TestMath < Test::Unit::TestCase
|
|||
check(0, Math.log10(1))
|
||||
check(1, Math.log10(10))
|
||||
check(2, Math.log10(100))
|
||||
check(Math.log10(2.0 ** 64), Math.log10(1 << 64))
|
||||
assert_equal(1.0/0, Math.log10(1.0/0))
|
||||
assert_nothing_raised { assert_infinity(-Math.log10(+0.0)) }
|
||||
assert_nothing_raised { assert_infinity(-Math.log10(-0.0)) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue