Michael Ulm wrote:
>> this floating problem is a faq and is very surprising on such a
>> very high language such as ruby.  can we address this? maybe create
>> flag like $EPSILON=0 or something, or may flag to revert to rational
>> or bigdeci like $FLOAT_PROCESSOR=RATIONAL...
> 
> Unfortunately, there is no easy solution to this problem. Here is a
> catalog of often proposed solutions and why they do not work:
> 
> 2 Always use  (x-y).abs < (x.abs + y.abs) * Float::EPSILON)  as a test 
> for equality.
> 
>  Better than the first proposal, but won't work if the rounding error
>  gets too large after a complex computation.
>  In addition, (1) and (2) suffer from the problem that x==y and y==z do
>  not imply x==z.

But it would fix 99% of problems. It would be worth it just for the sake 
of reducing those questions on the list :-P

Seriously though, since floating point calculations are approximative to 
start with, what would be wrong with making them more intuitive 
approximations? IMHO Float should use the above algorithm for == and 
reserve normal floating point arithmetic for eql?

Daniel