Integer Overflow
Skip Montanaro
skip at pobox.com
Tue Nov 27 14:55:48 EST 2001
>> In the current 2.2 beta, int operations that would overflow silently
>> return longs:
>>
>> >>> 3**100
>> 515377520732011331036461129765621272702107522001L
fp> Just curious: how bad is the performance impact from this (if any)?
Compared to what? ;-) Seriously, since I can't easily compute 3**100 without
resorting to longs, there's not really anything to compare it to.
Arithmetic with longs is substantially slower than with ints (looks like
about 4x slower for multiplication where operands and results are <=
sys.maxint), but may still be fast enough.
--
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)
More information about the Python-list
mailing list