I have a java script function that I'm trying to replicate in python 2, and the java script is doing some kind of precision error wrap around (or something) which I'm having trouble understanding. These are large numbers, but here's the example:
In javascript:
a = 3141592751
b = 1234567890
result = (a*31) ^ b
window.alert(result)
Here, result = -447877661. I'm assuming it's because of a bit limitation on storing large numbers and the related wrap around to a large negative number.
Using python 2:
a = 3141592751
b = 1234567890
result = (a*31) ^ b
print result
Here, result = 98336370147, which is correct mathematically.
How can I replicate the functionality of the javascript code using python? What is the wrap around point? Thanks!