Integer comparison

Lex Spoon lex at cc.gatech.edu
Sun Feb 22 19:02:36 UTC 2004


Juergen Bullinger <juergen.bullinger at gmx.net> wrote:
> For example:
> 
> (5883377743366005002288555544466433777 \\\ 2) = 
> (5883377743366005002288555544466433777 \\ 2)
> 
> results in false, although both expression answer 1, but the first
> expression answers a large postive int(1) and the last a int(1).

Andreas answered this recently.  You should not use \\\ unless you are
aware of its limitations.  It does not normalize its result, and thus
comparisons will not work correctly.  I don't know exactly what *does*
work correctly with un-normalized integers....  It would be nice to
document this, but in the meantime user beware!




> I wanted to change this behaviour myself, but I recognized that = uses a
> primitive implementation and if you want to change that behaviour you
> might want to do it there?!

Umm, I am not sure that = should be changed to handle this case.  If you
are willing to take the speed hit in order to make = behave properly,
then you may as well use regular division.


> I am thinking abotu implementing an Interface to GMP (Linux), could you give me some advice about where to search for documentation on how to do that?

This page looks helpful:  http://minnow.cc.gatech.edu/squeak/464 .

Also, the "nu blue book" has good info on writing plugins.


-Lex



More information about the Squeak-dev mailing list