summaryrefslogtreecommitdiff
path: root/test/bigdecimal
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-17 09:17:11 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-17 09:17:11 +0000
commit6b02097f798c27379e9e04e107507a7f54ea9a45 (patch)
treed293f01b2596fcef31d5bd8e6b5cb733077ff082 /test/bigdecimal
parent93e4ba927c565da6c56afa6e232d7a7e4b219a44 (diff)
* test/bigdecimal/test_bigdecimal.rb (TestBigDecimal#test_sqrt_bigdecimal):
test updated. a patch from TAKANO Mitsuhiro <takano32 at jus.or.jp> in [ruby-dev:36736]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/bigdecimal')
-rw-r--r--test/bigdecimal/test_bigdecimal.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb
index c1f67b8..35edc7a 100644
--- a/test/bigdecimal/test_bigdecimal.rb
+++ b/test/bigdecimal/test_bigdecimal.rb
@@ -466,7 +466,11 @@ class TestBigDecimal < Test::Unit::TestCase
x = BigDecimal.new("0.09")
assert_in_delta(0.3, x.sqrt(1), 0.001)
x = BigDecimal.new((2**100).to_s)
- assert_equal(true, x.sqrt(300).precs.last < x.sqrt(1200).precs.last)
+ y = BigDecimal("1125899906842624")
+ e = y.exponent
+ assert_equal(true, (x.sqrt(100) - y).abs < BigDecimal("1E#{e-100}"))
+ assert_equal(true, (x.sqrt(200) - y).abs < BigDecimal("1E#{e-200}"))
+ assert_equal(true, (x.sqrt(300) - y).abs < BigDecimal("1E#{e-300}"))
x = BigDecimal.new("-" + (2**100).to_s)
assert_raise(FloatDomainError) { x.sqrt(1) }
x = BigDecimal.new((2**200).to_s)