[squeak-dev] Float differences
Sven Van Caekenberghe
sven at beta9.be
Wed Apr 25 20:20:20 UTC 2012
The following code
((-10 to: 10) collect: [ :each | each * Float pi ])
((((-10 to: 10) collect: [ :each | each * Float pi ])
collect: [ :each | each asString])
collect: [ :each | Float readFrom: each ])
returns true on Pharo 1.4 and false on Squeak 4.3
Some of the Floats in the array compare equal, some not.
Similary, (10 raisedTo: -100) asFloat
prints as '1.0e-100' in Pharo and as ' 9.99999999999999e-101' in Squeak.
I know that comparing Floats on equality is often dangerous and that #closeTo: is better.
But I would like to understand how there could be such a difference between the two.
More information about the Squeak-dev