June 15, 2021
5:02 a.m.
On 15/06/2021 01:03, Esteban Maringolo wrote:
Sure, but what initiated this thread was a reference to roundTo: 0.1 which produced a "wrong" output.
(9.1 + (-2.0)) roundTo: 0.1 "=> 7.1000000000000005" 7.1 roundTo: 0.1 "=> 7.1000000000000005"
However, at this point I know that Pharo "does the right, raw, thing" (at least compared to other mainstream languages), but it still produces a surprise effect.
That's the "floating point surprise" that everyone has at some point, no matter the language and runtime system. If that surprise is a problem for you, are you sure that floating-point arithmetic is what you really want? Maybe your needs are better served with integers and fractions. Konrad.