aboutsummaryrefslogtreecommitdiffstats
path: root/ext/bigdecimal
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-22 07:52:17 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-22 07:52:17 +0000
commit2043bb5c3449e7bdb285a7178b934c3c2b68d733 (patch)
tree03833cb82220ff2159f3257e5a391bcc72ed6695 /ext/bigdecimal
parentc91ec25d19d0b0c2ecae1de8facb779d80665c78 (diff)
downloadruby-2043bb5c3449e7bdb285a7178b934c3c2b68d733.tar.gz
* 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
Diffstat (limited to 'ext/bigdecimal')
-rw-r--r--ext/bigdecimal/bigdecimal.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index af1d5246f5..88f56176b7 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -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);
}