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

ruby-changes:21235

From: naruse <ko1@a...>
Date: Fri, 16 Sep 2011 10:13:00 +0900 (JST)
Subject: [ruby-changes:21235] naruse:r33284 (trunk): Revert "* numeric.c (ruby_float_step): Avoid error on i386 and amd64."

naruse	2011-09-16 10:12:46 +0900 (Fri, 16 Sep 2011)

  New Revision: 33284

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

  Log:
    Revert "* numeric.c (ruby_float_step): Avoid error on i386 and amd64."
    
    r33282 challenged the precision of floating point but:
    * Ruby keeps it as platform dependent
    * amd64 won't get this issue because compilers for amd64 uses SSE2 to
      calculate floating point numbers instead of x87 FPU.
    * this change won't fix the issue under -O
    * this commit has no test for the changed behavior

  Modified files:
    trunk/ChangeLog
    trunk/numeric.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33283)
+++ ChangeLog	(revision 33284)
@@ -1,8 +1,3 @@
-Fri Sep 16 02:05:44 2011  Marc-Andre Lafortune  <ruby-core@m...>
-
-	* numeric.c (ruby_float_step): Avoid error on i386 and amd64.
-	  Patch by Vit Ondruch. Issue #4576.
-
 Thu Sep 15 11:39:43 2011  Nobuyoshi Nakada  <nobu@r...>
 
 	* gc.c (mark_entry, mark_key, mark_keyvalue): adjust callback
Index: numeric.c
===================================================================
--- numeric.c	(revision 33283)
+++ numeric.c	(revision 33284)
@@ -1683,7 +1683,6 @@
 	double unit = NUM2DBL(step);
 	double n = (end - beg)/unit;
 	double err = (fabs(beg) + fabs(end) + fabs(end-beg)) / fabs(unit) * epsilon;
-	double im = 0.0;
 	long i;
 
 	if (isinf(unit)) {
@@ -1692,8 +1691,7 @@
 	else {
 	    if (err>0.5) err=0.5;
 	    n = floor(n + err);
-	    im = ((long)n)*unit+beg;
-	    if (!excl || im < end) n++;
+	    if (!excl || ((long)n)*unit+beg < end) n++;
 	    for (i=0; i<n; i++) {
 		rb_yield(DBL2NUM(i*unit+beg));
 	    }

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

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