Javascript
1<<31
-2147483648
1<<32
1
Python
1<<31
2147483648
1<<32
4294967296
Is this related to max int? But 4294967296 not Bigger then the max int in js.
Javascript
1<<31
-2147483648
1<<32
1
Python
1<<31
2147483648
1<<32
4294967296
Is this related to max int? But 4294967296 not Bigger then the max int in js.
An integer in JavaScript is actually an IEEE 754 64bit float number. But an integer in Python may be a simple integer or a bignum.
All bit operations in JavaScript was defined on 32bit signed / unsigned integers. When you do these operations, the two operand was first converted to 32 bit integers, and the result will always be a 32 bit integer.
If you want multiple a number with 232, you should do 1 * 2 ** 32
(or 1 * Math.pow(2, 32)
in ES5) instead of this one.
Python has builtin bignum support, which support all bit operations such as shift left. As a result, you may shift a number with any (reasonable) bits and it may be greater than 232.