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:
parent
c91ec25d19
commit
2043bb5c34
3 changed files with 13 additions and 0 deletions
|
@ -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>
|
Fri Nov 22 16:25:43 2013 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* gc.c (heap_set_increment): accept minumum additional page number.
|
* gc.c (heap_set_increment): accept minumum additional page number.
|
||||||
|
|
|
@ -2381,6 +2381,9 @@ retry:
|
||||||
GUARD_OBJ(y, VpCreateRbObject(1, "0"));
|
GUARD_OBJ(y, VpCreateRbObject(1, "0"));
|
||||||
}
|
}
|
||||||
VpPower(y, x, int_exp);
|
VpPower(y, x, int_exp);
|
||||||
|
if (VpIsDef(y)) {
|
||||||
|
VpMidRound(y, VpGetRoundMode(), n);
|
||||||
|
}
|
||||||
return ToValue(y);
|
return ToValue(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1123,6 +1123,9 @@ class TestBigDecimal < Test::Unit::TestCase
|
||||||
e = BigDecimal("2.71828182845904523536028747135266249775724709369996")
|
e = BigDecimal("2.71828182845904523536028747135266249775724709369996")
|
||||||
pow = BigDecimal("22.459157718361045473")
|
pow = BigDecimal("22.459157718361045473")
|
||||||
assert_equal(pow, pi.power(e, 20))
|
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
|
end
|
||||||
|
|
||||||
def test_limit
|
def test_limit
|
||||||
|
|
Loading…
Reference in a new issue