[squeak-dev] Bug in Floats?

Vaidotas Didžbalis vaidasd at gmail.com
Thu Apr 10 09:16:27 UTC 2014


Thank you for clarification.
Vaidotas

On Wed, Apr 9, 2014 at 9:16 PM, Nicolas Cellier
<nicolas.cellier.aka.nice at gmail.com> wrote:
>
> 2014-04-09 17:53 GMT+02:00 Chris Muller <asqueaker at gmail.com>:
>
>> It's just a different printOn: method.  The new one shows the "truth".
>>  You must now use one of the print formatting methods to display
>> pretty Floats.
>>
>> On Wed, Apr 9, 2014 at 10:07 AM, Vaidotas Didžbalis <vaidasd at gmail.com>
>> wrote:
>> > 1245 *  0.01 evaluates to 12.45 in Squeak 4.3, but it is
>> > 12.450000000000001 in later versions.
>> > regatds,
>> > Vaidotas
>> >
>>
>
> Every two different Float shall have a different printString:
> (12.45) = (1245*0.01) -> false.
> So...
>
> The printString shall be the shortest decimal that rounds to the same float.
> It's hard to demonstrate with a simple snippet, but you can check that we
> are very close yet:
> ((Fraction readFrom: '12.450000000000001') - (1245*0.01) asTrueFraction) /
> (1245*0.01) ulp.
> ((Fraction readFrom: '12.45') - (1245*0.01) asTrueFraction) / (1245*0.01)
> ulp.
>
>
>
>
>


More information about the Squeak-dev mailing list