LargePositiveInteger>>#\\\ vs. LargePostitveInteger>>#\\

Juergen Bullinger juergen.bullinger at gmx.net
Sun Feb 22 18:55:27 UTC 2004


Hi all,

I looked again at the implementation of \\ and \\\.
They seem to be equivalent. The only difference I recognized was, that
\\\ always returns an instance of Large...Integer (I think always
LargePositiveInteger), but besides that they seem to do exactly the
same. But I have to admit, that I only tested with integers.

If that is really the only difference I wonder why you don't unify this
two implementations?
I recognized that \\\ runs much faster even if you send #normalize to
its result. And if I am right.

(a \\\ b) normalize

is absolutely equivalent to:

a \\ b

but the first one is much faster at least on my system.

Besides that I recognized that the implmentation of

Integer>>raisedTo: y modulo: n

uses \\\ it looks even, that this is the only sender of \\\.
Please note that all senders of this method might have a problem,
because within this method #normalize is not beeing sent. Because of
this raisedTo: modulo: might return a LargeInt which contains a value
that fits into a small int. This would result in an error if you try to
compare a small int value with the computed value, because small ints
and large ints are never equal :o(

Cheers Juergen




More information about the Squeak-dev mailing list