On 16 September 2011 15:49, Tanaka Akira <akr / fsij.org> wrote:
> 2011/9/16 Marc-Andre Lafortune <ruby-core / marc-andre.ca>:
>
>> Yes, floats can be complicated. No I wouldn't recommend to anyone to play with tight limits with floats. But here, it is simply not acceptable that`(foo...bar).step(baz).to_a.last == bar`. On any platform. This is nota question of learning floating point number.
>
> Interesting.
>
> Please show us an actual example of `(foo...bar).step(baz).to_a.last == bar`

== is meaningless with floats.

The previous issue ( the value before the excluded end of the range
not being reached) was most likely the result of guarding against
this:

(1.0...128.4).step(18.2).to_a
=> [1.0, 19.2, 37.4, 55.599999999999994, 73.8, 92.0, 110.19999999999999, 128.4]

I am quite sure that the 128.4 are not the same.

Still Ruby does not display the difference so the result is quite confusing.

Thanks

Michal