mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
93e4ba927c
commit
6b02097f79
2 changed files with 11 additions and 1 deletions
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue