IE8 Bug in bitwise operators for JavaScript
This will be a very quick entry: I just wanted to report a bug I
discovered in IE8 that I could not find any information about. IE8
appears to have a bug with its bitwise operators in JavaScript (right
shift, unsigned right shift, and bitwise or – maybe more). The bug
is: whenever the left operand is greater or equal to 2^63
, the
operator returns zero.
In other words, if the operand has its high bit set when converted to
uint64
, these operators will return 0 instead of their correct
value.
Here are a few quick test cases:
In correct browsers, these expressions will print non-zero values. In IE8, they print zero.
I don’t expect Microsoft ever to fix this because IE8 is so old. I just wanted to get the word out so that when someone else sees something fishy going on with their code, they can Google “IE8 bitwise operators bug” and find this page instead of no information about the bug.
If there is already a bug report for this somewhere, please let me know!