diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-28 14:25:59 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-28 14:25:59 +0000 |
commit | 202cc8e615975d67659d517bac04b8697c34c2f0 (patch) | |
tree | 0abf4de8dc11901483e22c662b0f8ce66d85f137 /test | |
parent | f450dede0e71b0db8ec0ba2f31f6907a778e3fbb (diff) |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_math.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_math.rb b/test/ruby/test_math.rb index 3895eec7f5..a715769380 100644 --- a/test/ruby/test_math.rb +++ b/test/ruby/test_math.rb @@ -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)) } |