summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--numeric.c4
2 files changed, 1 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 9aae07f95e..7bdeddec37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,3 @@
-Fri Sep 16 02:05:44 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * 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@ruby-lang.org>
* gc.c (mark_entry, mark_key, mark_keyvalue): adjust callback
diff --git a/numeric.c b/numeric.c
index 1701d1005e..18f5e1cd1a 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1683,7 +1683,6 @@ ruby_float_step(VALUE from, VALUE to, VALUE step, int excl)
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 @@ ruby_float_step(VALUE from, VALUE to, VALUE step, int excl)
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));
}