[前][次][番号順一覧][スレッド一覧]

ruby-changes:31724

From: mrkn <ko1@a...>
Date: Fri, 22 Nov 2013 22:31:33 +0900 (JST)
Subject: [ruby-changes:31724] mrkn:r43803 (trunk): * ext/bigdecimal/bigdecimal.c (BigDecimal_power):

mrkn	2013-11-22 22:31:26 +0900 (Fri, 22 Nov 2013)

  New Revision: 43803

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43803

  Log:
    * ext/bigdecimal/bigdecimal.c (BigDecimal_power):
      Round the result value only if the precision is given.

  Modified files:
    trunk/ChangeLog
    trunk/ext/bigdecimal/bigdecimal.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43802)
+++ ChangeLog	(revision 43803)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Nov 22 22:30:00 2013  Kenta Murata  <mrkn@m...>
+
+	* 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@r...>
 
 	* transcode.c (str_transcode0): don't scrub invalid chars if
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 43802)
+++ ext/bigdecimal/bigdecimal.c	(revision 43803)
@@ -2383,7 +2383,7 @@ retry: https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2383
 	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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]