diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-04 00:55:15 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-04 00:55:15 +0000 |
commit | c6f0e312be4284607411b66db68ed46f083a5de8 (patch) | |
tree | 1d1b42e4796061ff14c20b8631970a47f6b9cb95 /test | |
parent | cdd10ca17fffd433d7a0e42670f7bf65985eacdc (diff) | |
download | ruby-c6f0e312be4284607411b66db68ed46f083a5de8.tar.gz |
bigdecimal.c: more precision
* ext/bigdecimal/bigdecimal.c (BigDecimal_div2): need more room
for precision to round. [ruby-core:77475] [Bug #12805]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/bigdecimal/test_bigdecimal.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index 4296b50c59..63a3e2747d 100644 --- a/test/bigdecimal/test_bigdecimal.rb +++ b/test/bigdecimal/test_bigdecimal.rb @@ -807,6 +807,12 @@ class TestBigDecimal < Test::Unit::TestCase BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, false) assert_equal(0, BigDecimal("0").div(BigDecimal("Infinity"))) end + + x = BigDecimal.new("1") + y = BigDecimal.new("0.22") + (2..20).each do |i| + assert_equal ("0."+"45"*(i/2)+"5"*(i%2)+"E1"), x.div(y, i).to_s, "#{i}" + end end def test_abs_bigdecimal |