>> Even in 1.8, the following returns the result including error:
>>
>> =A0p 1.4 - 0.1 - 1.2 =A0#=3D> 0.0999999999999999
>>
>> It may cause a bug that is hard to test and reproduce.

True--for me, though, having to_s "pretty" and inspect show you what
is going on seems to satisfy both cases...

> Let's make Float beautiful with default printing ;)



>> Honestly, I used to like the old behavior. =A0But I knew that the
>> implementation of the old behavior was very uncool and dirty.
>> It is almost like:
>>
>> =A0("%.15f" % float).sub(/0+$/, "")
>>
>> Now I dislike the old behavior.

Agreed.  Currently, though, we dislike the old behavior and many
dislike the new behavior, too.




> We are most of us agreeing to a cleaner syntax, while we don't want to
> cheat and remove too much accuracy
>
> So, double have a range of (2**-52) ~ 2e-16. We then should round at
> 15~16 digits:
>
>> n =3D 1.4 - 0.1 - 1.2
> =3D> 0.09999999999999987
>> "%.15f" % n
> =3D> "0.100000000000000"
>> "%.16f" % n
> =3D> "0.0999999999999999"
>
> 15 looks fine to me, because we all know Float aren't accurate with
> some operations.
>
> Current implementation go until the 17th digit, which is non-sense for a =
double.

It looks ok to me:

1.8.6:

>> 1.4 - 0.1 - 1.2
=3D> 0.09999999999999986700

C:\dev>pik 192

>> 1.4 - 0.1 - 1.2
=3D> 0.09999999999999987

Thoughts?
-rp