I'm trying to bitshift a number. Usually it works as expected, clipping anything above 32 bits.
num=2200131600391;
console.log((num).toString(2)); //100000000001000010000100000000000000000111
console.log((num>>1).toString(2)); //100001000010000000000000000011
However when I bitshift left once, the result becomes negative, and the numbers seem random.
console.log((num<<1).toString(2)); //-1111011110111111111111111110010
In order to verify whether the issue is with shifting left, I tried this.
console.log((num).toString(2)); //100000000001000010000100000000000000000111
console.log((num<<2).toString(2)); //1000010000000000000000011100
console.log((num<<3).toString(2)); //10000100000000000000000111000
So left shifting twice, thrice, and presumably any number more than once, doesn't give an error. Is there something unique about <<1 operator that is giving unexpected results?