Skip to content

Commit 99cc2d5

Browse files
authored
Add BigMath::E and BigMath::PI precision test (#414)
1 parent 4fe723c commit 99cc2d5

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

test/bigdecimal/test_bigmath.rb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,20 @@ class TestBigMath < Test::Unit::TestCase
1313
MINF = BigDecimal("-Infinity")
1414
NAN = BigDecimal("NaN")
1515

16-
def test_const
17-
assert_in_delta(Math::PI, PI(N))
18-
assert_in_delta(Math::E, E(N))
16+
def test_pi
17+
assert_equal(
18+
BigDecimal("3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068"),
19+
PI(100).round(100)
20+
)
21+
assert_relative_precision {|n| PI(n) }
22+
end
23+
24+
def test_e
25+
assert_equal(
26+
BigDecimal("2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427"),
27+
E(100)
28+
)
29+
assert_relative_precision {|n| E(n) }
1930
end
2031

2132
def test_sqrt

0 commit comments

Comments
 (0)