Integer Overflow
Michael Hudson
mwh at python.net
Tue Nov 27 13:18:48 EST 2001
"Ursus Horibilis" <ursus_horibilis at hotmail.com> writes:
> Okay. My next project was to do the same thing with 64-bit
> numbers.
This makes a difference how, exactly?
> So how do I disable trapping for integer overflow?
You can't, in the way you want anyway.
You could always write a class that uses longs and chops off all but
the first n bits of the result. This wouldn't do performance any
favours, I uspect.
Not that in 2.1:
>>> 2*sys.maxint
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: integer multiplication
but in 2.2:
>>> 2*sys.maxint
4294967294L
Cheers,
M.
--
Of course, it obviously is beta hardware so such things are to be
expected, but that doesn't mean that you can't point your fingers
and generate a nelson style HAHA at a multi billion dollar
corporation's expense. -- CmdrTaco on slashdot.org
More information about the Python-list
mailing list