diff options
author | Kenta Murata <mrkn@mrkn.jp> | 2021-01-22 13:49:46 +0900 |
---|---|---|
committer | Kenta Murata <mrkn@mrkn.jp> | 2021-12-24 02:28:55 +0900 |
commit | 7b2cfce543b876744544c8b43abdee3c72cab910 (patch) | |
tree | 7d41e1f733856b4206a9987d6c8a7d462fad24f2 /test/bigdecimal | |
parent | e1265c819870c6a4d6763529e9fbd2d70c722fe0 (diff) | |
download | ruby-7b2cfce543b876744544c8b43abdee3c72cab910.tar.gz |
[ruby/bigdecimal] Let BigDecimal_DoDivmod use the same precision calculation as BigDecimal_divide
https://github.com/ruby/bigdecimal/commit/11cb2c8840
Diffstat (limited to 'test/bigdecimal')
-rw-r--r-- | test/bigdecimal/test_bigdecimal.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index 66b58aa124..26d346b364 100644 --- a/test/bigdecimal/test_bigdecimal.rb +++ b/test/bigdecimal/test_bigdecimal.rb @@ -1043,6 +1043,13 @@ class TestBigDecimal < Test::Unit::TestCase assert_raise(ZeroDivisionError){BigDecimal("0").divmod(0)} end + def test_divmod_precision + a = BigDecimal('2e55') + b = BigDecimal('1.23456789e10') + q, r = a.divmod(b) + assert_equal((a/b), q) + end + def test_divmod_error assert_raise(TypeError) { BigDecimal(20).divmod('2') } end |