Hi,

On Wed, Mar 31, 2010 at 2:37 PM, Yusuke ENDOH <mame / tsg.ne.jp> wrote:
> Hi,
>
> 2010/4/1 Marc-Andre Lafortune <redmine / ruby-lang.org>:
>> 1) First, there is currently a bug in trunk:
>>
>> 72.9.to_s # =3D=3D> "72.90000000000001"
>>
>> This is plainly wrong.
>
> I guess that your story is not logical.
>
> Consider 72.90000000000001.to_s. =A0With your suggestion, it will return
> "72.9". =A0Don't you complain the behavior?

Sorry if I wasn't clear.

Indeed, 72.900000000001.to_s.should =3D=3D "72.9", and this is fine because=
:
72.90000000000001 =3D=3D 72.9  # =3D> true

If float1 =3D=3D float2, then float1.to_s should =3D=3D float2.to_s, and th=
at
#to_s should be the simplest possible. If I understand the rest of
your comment, you basically agree with this too :-)

> I think Float#to_s can select any representation. =A0Any representation
> is not "wrong", and

Wrong was maybe not the right word. Maybe I should have said "strongly
undesirable" instead.

>> #to_s (and #inspect) should choose the simplest string representation th=
at is included in the approximate range a float represents.
>
> it is the best representation, I agree.
>
> I wonder whether or not the suggestion is included in 1.9.2...

I didn't realize 72.9.to_s had changed this way in 1.9 until today. I
don't consider this a feature request but a bug and a regression which
should be reverted.