ruby-changes:21233
From: marcandre <ko1@a...>
Date: Fri, 16 Sep 2011 02:14:02 +0900 (JST)
Subject: [ruby-changes:21233] marcandRe: r33282 (trunk): * numeric.c (ruby_float_step): Avoid error on i386 and amd64.
marcandre 2011-09-16 02:13:51 +0900 (Fri, 16 Sep 2011) New Revision: 33282 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33282 Log: * numeric.c (ruby_float_step): Avoid error on i386 and amd64. Patch by Vit Ondruch. Issue #4576. Modified files: trunk/ChangeLog trunk/numeric.c Index: ChangeLog =================================================================== --- ChangeLog (revision 33281) +++ ChangeLog (revision 33282) @@ -1,3 +1,8 @@ +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 33281) +++ numeric.c (revision 33282) @@ -1683,6 +1683,7 @@ 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)) { @@ -1691,7 +1692,8 @@ else { if (err>0.5) err=0.5; n = floor(n + err); - if (!excl || ((long)n)*unit+beg < end) n++; + im = ((long)n)*unit+beg; + if (!excl || im < 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/