2011/9/17 Marc-Andre Lafortune <ruby-core / marc-andre.ca>:
>
> I'd like to thank Vit Ondruch and Ale Mareek for pointing outthis issue, investigating it and providing insight as to how to fix it.
>
> I am sorry that this problem has not been fixed yet. I completely agree that this is a bug and that Ruby_with_patch >= Ruby_without_patch.

I don't think the patch is a appropriate fix for this problem.

The test, "n*unit+beg < end", is fragile.

n*unit+beg can be different from the true mathematical value because
floating point calculation errors, as you know.
It can be bigger or smaller than the true value.

So the test should be changed to "n*unit+beg - e < end" for a estimated
maximum error, e.

I beleave the result of "*" and "+" is the nearest representable value of
the true mathematical result.

So I guess the maximum error is abs(a*DBL_EPSILON) + abs(b*DBL_EPSILON)
where a = n*unit and b = a + beg.

The estimate may be too small as considering double rounding problem
of x86 80bit float issue, though.

Note that I am not a expert of floating point calculations.
Is there someone can validate the above logic?
-- 
Tanaka Akira