1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/bigdecimal/bigdecimal.c (BigDecimal_power): Round the result value.

[Bug #8818] [ruby-core:56802]

* test/bigdecimal/test_bigdecimal.rb: Add a test for the above fix.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mrkn 2013-11-22 07:52:17 +00:00
parent c91ec25d19
commit 2043bb5c34
3 changed files with 13 additions and 0 deletions

View file

@ -1,3 +1,10 @@
Fri Nov 22 16:49:00 2013 Kenta Murata <mrkn@mrkn.jp>
* ext/bigdecimal/bigdecimal.c (BigDecimal_power): Round the result value.
[Bug #8818] [ruby-core:56802]
* test/bigdecimal/test_bigdecimal.rb: Add a test for the above fix.
Fri Nov 22 16:25:43 2013 Koichi Sasada <ko1@atdot.net>
* gc.c (heap_set_increment): accept minumum additional page number.

View file

@ -2381,6 +2381,9 @@ retry:
GUARD_OBJ(y, VpCreateRbObject(1, "0"));
}
VpPower(y, x, int_exp);
if (VpIsDef(y)) {
VpMidRound(y, VpGetRoundMode(), n);
}
return ToValue(y);
}

View file

@ -1123,6 +1123,9 @@ class TestBigDecimal < Test::Unit::TestCase
e = BigDecimal("2.71828182845904523536028747135266249775724709369996")
pow = BigDecimal("22.459157718361045473")
assert_equal(pow, pi.power(e, 20))
b = BigDecimal('1.034482758620689655172413793103448275862068965517241379310344827586206896551724')
assert_equal(BigDecimal('0.114523E1'), b.power(4, 5), '[Bug #8818] [ruby-core:56802]')
end
def test_limit