[squeak-dev] Some strange behavior

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Fri Oct 29 11:34:41 UTC 2010


2010/10/28 Bert Freudenberg <bert at freudenbergs.de>:
> On 28.10.2010, at 22:30, Hans-Martin Mosner wrote:
>
>> The fact that Squeak prints 6 * 0.2 as 1.2 and not as 1.2000000000000002
>> is a result of the particular algorithm that is being used for printing
>> floats as decimal numbers.
>
> (6 * 0.2) storeString
>
> ==> '1.2000000000000002'
>
> - Bert -
>
>

I would add that Squeak4.1 now gives your some insights about what is going on.
You can try to evaluate these expressions:
   (1/5) = 0.2.
   (1/5) asFloat = 0.2.
   0.2 asTrueFraction.

Nicolas



More information about the Squeak-dev mailing list