diff options
author | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-10 14:05:07 +0000 |
---|---|---|
committer | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-10 14:05:07 +0000 |
commit | 99f8f14d89308c17d8e9e53e03dd5ead6984e7fc (patch) | |
tree | 0282d70e2ad245a3f1cdec88f7f0929694592960 /test/bigdecimal | |
parent | 819c2418b11d911f9ff0c81ad13a82f43b1092ee (diff) |
* ext/bigdecimal/bigdecimal.c (rmpd_power_by_big_decimal): fix
precision treatment errors.
* test/bigdecimal/test_bigdecimal.rb: add tests for the above change.
fix precision treatment errors.
* ext/bigdecimal/bigdecimal.c (BigDecimal_power): precision argument
should be optional for its compatibility.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/bigdecimal')
-rw-r--r-- | test/bigdecimal/test_bigdecimal.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index 9bd068bfe5..96211a09c7 100644 --- a/test/bigdecimal/test_bigdecimal.rb +++ b/test/bigdecimal/test_bigdecimal.rb @@ -964,6 +964,20 @@ class TestBigDecimal < Test::Unit::TestCase end end + def test_power_without_prec + pi = BigDecimal("3.14159265358979323846264338327950288419716939937511") + e = BigDecimal("2.71828182845904523536028747135266249775724709369996") + pow = BigDecimal("22.4591577183610454734271522045437350275893151339967843873233068") + assert_equal(pow, pi.power(e)) + end + + def test_power_with_prec + pi = BigDecimal("3.14159265358979323846264338327950288419716939937511") + e = BigDecimal("2.71828182845904523536028747135266249775724709369996") + pow = BigDecimal("22.459157718361045473") + assert_equal(pow, pi.power(e, 20)) + end + def test_limit BigDecimal.limit(1) x = BigDecimal.new("3") |