integer multiplication

Terry Reedy tjreedy at
Mon Apr 4 21:04:32 CEST 2011

On 4/4/2011 1:20 PM, geremy condra wrote:
> On Mon, Apr 4, 2011 at 9:41 AM, Terry Reedy<tjreedy at>  wrote:

>> (I believe that retaining two implementations internally was considered but
>> rejected. Could be wrong.)
> There are two implementations, grade school multiplication and
> karatsuba, which kicks in after a given cutoff.

I meant internally retaining the 2.7 machine int and unbounded long types.

>> I am curious how gmpy compares to 3.x ints (longs) with small number
>> calculations like 3+5 or 3*5.
> I have this data somewhere, if you're interested I'll try to dredge it up.

My question is whether gmpy ints could be a complete substitute for 3.x 
ints, or whether speed for bit (1000 digit) ints came at the expense of 
extra overhead making small int calculations slower. That is separate 
from the issue of whether gmpy ints implement the entire int interface, 
or whether they currently inter-operate with other types as well.

Terry Jan Reedy

More information about the Python-list mailing list