I want to transfer the following python code to javascript:
def conv_2c(val, bits):
return ((1 << bits)+val)
function conv_2c(val, bits){
return ((1 << bits)+val);
}
In Python print(conv_2c(-944,64))
gives me 18446744073709550672 , while
in JS console.log(conv_2c(-944,64));
gives me -943 . Why is there a difference?? Is this something to worry about (do the numbers really differ?) or is it a thing of how Python or JS print negative/ two's complement numbers?