Hi Sven, > > If in Pharo [1] you do: > > a := 6.7 + (32.8 - 35) > > It will produce: > > 4.499999999999997 > > Which, when rounded, will produce 4.
> But, > a roundTo: 0.1 "=> 4.5" 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. In particular when people go to Excel to "check that your system does the right thing", uses the same formula and it gives a different result to them. Then open a calculator (or a physical one) and it gives the same number as Excel. So an hour after the fact you're arguing about floating point implementations to non-technical people :-) Regards! Esteban A. Maringolo