From 202cc8e615975d67659d517bac04b8697c34c2f0 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 28 Sep 2013 14:25:59 +0000 Subject: 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 --- test/ruby/test_math.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') 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)) } -- cgit v1.2.3