Project

General

Profile

Bug #4576 ยป 0001-Fix-the-ronding-error-causing-wrong-evaluation-of-ra.patch

vo.x (Vit Ondruch), 08/30/2011 05:52 PM

View differences:

numeric.c
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)) {
......
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));
}
    (1-1/1)