[Newbies] asInteger bug?

bb bblochl at arcor.de
Mon Jun 27 16:27:43 UTC 2011

There I found a problem with asInteger:

According to the x3j20 ansi standard Float>>asInteger and
Double>>asInteger should be equivalent to sending rounded. You can
download the final draft revision for free:

I tried that in squeak 4.2:
1.11 asInteger 1
1.99 asInteger 1
1.11 rounded 1
1.99 rounded 2

Astonishing is the result as well:
(0.6 / 0.2) asInteger 2

That seems to be the conversion Problem of odd decimals to binary, well
known from most of the programming languages.

Here another experiment:
2.999999999999 asInteger   2
2.999999999999 rounded 3
2.999999999999999 asInteger  2
2.9999999999999999 asInteger 3

Is squeak/Smalltalk not x3j20 ansi standard compliable?


B. Blochl

More information about the Beginners mailing list