summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-22 13:31:26 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-22 13:31:26 +0000
commit909d14a1dbd94e6133b3df5fc80e114fec655fa9 (patch)
tree96e75320d4d0ad5d5e6783d25377a7347fb6bcc8
parent95a6be1a177976e75e06c1a8f55b438898bee3a2 (diff)
* ext/bigdecimal/bigdecimal.c (BigDecimal_power):
Round the result value only if the precision is given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ext/bigdecimal/bigdecimal.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b32b1a98f5..fffcc76a81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Nov 22 22:30:00 2013 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_power):
+ Round the result value only if the precision is given.
+
Fri Nov 22 17:20:50 2013 NARUSE, Yui <naruse@ruby-lang.org>
* transcode.c (str_transcode0): don't scrub invalid chars if
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 0ed5147c9d..f630c0a167 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -2383,7 +2383,7 @@ retry:
GUARD_OBJ(y, VpCreateRbObject(1, "0"));
}
VpPower(y, x, int_exp);
- if (VpIsDef(y)) {
+ if (!NIL_P(prec) && VpIsDef(y)) {
VpMidRound(y, VpGetRoundMode(), n);
}
return ToValue(y);