summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--test/bigdecimal/test_bigdecimal.rb6
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 1fc799d947..242384ad0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Oct 17 18:16:51 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * 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].
+
Fri Oct 17 18:14:57 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (uncommon.mk): ignores failures at loading.
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb
index c1f67b8c90..35edc7a44a 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)