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

ruby-changes:8693

From: matz <ko1@a...>
Date: Wed, 12 Nov 2008 13:39:29 +0900 (JST)
Subject: [ruby-changes:8693] Ruby:r20228 (ruby_1_8): * ext/bigdecimal/bigdecimal.c (VpMidRound): Round method bug

matz	2008-11-12 13:39:11 +0900 (Wed, 12 Nov 2008)

  New Revision: 20228

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

  Log:
    * ext/bigdecimal/bigdecimal.c (VpMidRound): Round method bug
      pointed by Ryan Platte fixed(Patch to the patch from "NATORI
      Shin").  [ruby-talk:273360]
      back ported from 1.9. fix [ruby-core:19791]

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/ext/bigdecimal/bigdecimal.c

Index: ruby_1_8/ext/bigdecimal/bigdecimal.c
===================================================================
--- ruby_1_8/ext/bigdecimal/bigdecimal.c	(revision 20227)
+++ ruby_1_8/ext/bigdecimal/bigdecimal.c	(revision 20228)
@@ -4349,6 +4349,11 @@
     nf += y->exponent*((int)BASE_FIG);
     exptoadd=0;
     if (nf < 0) {
+	/* rounding position too left(large). */
+	if((f!=VP_ROUND_CEIL) && (f!=VP_ROUND_FLOOR)) {
+	    VpSetZero(y,VpGetSign(y)); /* truncate everything */
+	    return 0;
+	}
         exptoadd = -nf;
         nf = 0;
     }
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 20227)
+++ ruby_1_8/ChangeLog	(revision 20228)
@@ -10,6 +10,13 @@
 
 	* eval.c (search_required): ditto.
 
+Tue Nov 11 21:18:36 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* ext/bigdecimal/bigdecimal.c (VpMidRound): Round method bug
+	  pointed by Ryan Platte fixed(Patch to the patch from "NATORI
+	  Shin").  [ruby-talk:273360]
+	  back ported from 1.9. fix [ruby-core:19791]
+
 Tue Nov 11 17:51:30 2008  NAKAMURA Usaku  <usa@r...>
 
 	* win32/win32.c (rb_w32_accept): secure fd before accept because if

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

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