In JavaScript, using any bitwise operator causes the number to be first truncated to a 32-bit integer. That means it won't work for some larger values. (Well, quite a few larger values :-)
The %
operator doesn't do that.
edit — hey all you nice people who've upvoted me: hold your horses :-) C5H8NNaO4 points out that the integer truncation process should preserve the low bit, which makes intuitive sense if you think about just lopping off the top part of the mantissa, and indeed some cursory "tests" indicate that it seems to work fine.
Things get more complicated of course for really large values, which when represented in imprecise floating point may be either odd or even, since the least-significant digits are missing. In other words, when the binary exponent in a floating point value results in an effective value that's larger than the mantissa capacity (53 bits I think), then you either have to consider all such numbers even (because the low bits are always zero) or else you have to consider the question indeterminate.
It should be clear that I'm not a mathematician.