Adding a positive number and a negative number

Steve Holden steve at holdenweb.com
Fri Jan 30 19:35:40 EST 2009


Scott David Daniels wrote:
> Grant Edwards wrote:
>> On 2009-01-30, MRAB <google at mrabarnett.plus.com> wrote:
>>> Eric Kang wrote:
>>>> In two's complement representation, can adding one positive
>>>> and one negative give you overflow?
>>> No.
>> AFAIK, in Python adding integers never gives you overlow
>> regardless of sign.
> 
> Right, but he wants his homework answer.

And Python doesn't use pure two's complement notation when it promotes
regular integers to longs.

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list