[squeak-dev] Float rounding issue

Chris Muller asqueaker at gmail.com
Mon May 7 03:24:37 UTC 2012


( 0.9580000000000001 roundTo: 0.0001) = 0.9580   "false"



On Sun, May 6, 2012 at 8:55 PM, Levente Uzonyi <leves at elte.hu> wrote:
> On Sun, 6 May 2012, Chris Muller wrote:
>
>> With the latest trunk updates, I'm having trouble rounding to my
>> desired precision:
>>
>>    0.9580000000000001 roundTo: 0.0001    " 0.9580000000000001"
>>
>> In Squeak 4.3 I get what I expect:
>>
>>    0.9580000000000001 roundTo: 0.0001   " 0.958"
>>
>>
>
> I'm pretty sure it's just a difference in printing. 0.958 is unlikely to
> have an exact base 2 representation.
>
>
> Levente
>


More information about the Squeak-dev mailing list