Integer comparison

Juergen Bullinger juergen.bullinger at gmx.net
Wed Feb 18 22:07:48 UTC 2004


Hallo all,

I just tried out squeak.
I use Smalltalk for private number theoretical observations.
Maybe it sounds odd, but I am used to Smalltalk (I use VA in my job) and
I recognized that it is rather fast on large number computations.
For example I computed a prime number with > 700 digits in Smalltalk in
about 20 hours on a Pentium III machine :o)

So far I used VA for that but wanted to take a look also at other
flavours. Squeak is interesting, because it has cross compilation
capabilities if i am right.
I know of squeak since some years and actually tried it out some years
ago and I was very surprised when I looked at the new version. It seems
to have gone a far way.

On my trials I found out, that values of large postive integer don't
equal values of integer even if the values represent the same value.
Is this behaviour intended?

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).

I just wanted to to do some performance comparisons between VA and
Squeak and recognized that \\\ performs faster than \\ but I was not
sure if it does what i intended, so I implemented a loop comparing the
results of this two operations.

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?!

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?

Thank you in advance

Juergen






More information about the Squeak-dev mailing list