1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test_bigmath.rb: test_log

* test/bigdecimal/test_bigmath.rb (test_log): add basic test for BigMath.log.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-01-11 10:26:05 +00:00
parent c855854eeb
commit 1367f28a49

View file

@ -60,4 +60,11 @@ class TestBigMath < Test::Unit::TestCase
assert_equal(BigDecimal("0.823840753418636291769355073102514088959345624027952954058347023122539489"),
atan(BigDecimal("1.08"), 72).round(72), '[ruby-dev:41257]')
end
def test_log
assert_equal(0, BigMath.log(BigDecimal("1.0"), 10))
assert_in_epsilon(Math.log(10)*1000, BigMath.log(BigDecimal("1e1000"), 10))
assert_raise(Math::DomainError) {BigMath.log(BigDecimal("0"), 10)}
assert_raise(Math::DomainError) {BigMath.log(BigDecimal("-1"), 10)}
end
end