diff options
author | Kenta Murata <mrkn@mrkn.jp> | 2021-12-24 00:26:34 +0900 |
---|---|---|
committer | Kenta Murata <mrkn@mrkn.jp> | 2021-12-24 02:29:01 +0900 |
commit | a1d9fbef05fbf507b4c68cf3fbc50c6e27a3293e (patch) | |
tree | 3a3c4aa93c8a222f782d0ff70e17bf771aaea838 /test/bigdecimal/test_bigdecimal.rb | |
parent | 680a4ebb3ce7a3028b897204c2f0d3a546194eb8 (diff) |
[ruby/bigdecimal] Fix the result precision of BigDecimal#divmod
https://github.com/ruby/bigdecimal/commit/a32f6cb9e2
Diffstat (limited to 'test/bigdecimal/test_bigdecimal.rb')
-rw-r--r-- | test/bigdecimal/test_bigdecimal.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index bbfcbec4df..825d7ec93f 100644 --- a/test/bigdecimal/test_bigdecimal.rb +++ b/test/bigdecimal/test_bigdecimal.rb @@ -1047,11 +1047,13 @@ class TestBigDecimal < Test::Unit::TestCase a = BigDecimal('2e55') b = BigDecimal('1.23456789e10') q, r = a.divmod(b) - assert_equal((a/b), q) + assert_equal((a/b).round(0, :down), q) + assert_equal((a - q*b), r) b = BigDecimal('-1.23456789e10') q, r = a.divmod(b) - assert_equal((a/b), q) + assert_equal((a/b).round(0, :down) - 1, q) + assert_equal((a - q*b), r) end def test_divmod_error |