Thursday, 12 September 2013

Python:Let Python int overflow like C int

Python:Let Python int overflow like C int

In Python, when a int bigger than 2**31, then it will turn to a long:
a = 2147483647 a + 1 = 2147483648
b = -2147483648 b - 1 = -2147483649
but I need the Python int overflow like the int in C:
a = 2147483647 a + 1 = -2147483648
b = -2147483648 b - 1 = 2147483647
Is it possible? thanks in advance!

No comments:

Post a Comment