Bug #4576 ยป 0001-Fix-the-ronding-error-causing-wrong-evaluation-of-ra.patch
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));
|
||
}
|