[squeak-dev] truncatedTo: / roundTo: oddities with fractions

Rein, Patrick Patrick.Rein at hpi.de
Wed Jul 31 11:53:38 UTC 2019

Hi everyone,

a student recently encountered the following behavior:

fraction := 5 / 9.
(fraction* 100) truncateTo: 0.01. “55.550000000000004"
fraction:= 1/18.
(fraction * 100) roundTo: 0.01. “5.5600000000000005"

This is not what I would expect from #truncateTo: or #roundTo: even when using Floats (especially roundTo:).

Is this what we want or an open issue? I have not found any test covering the protocol.


More information about the Squeak-dev mailing list