3 ms·
Javascript as well: >> -2 % 2 -0 >> -3 % 2 -1 Edit: well, at least in Firefox JS. I have no idea if that's actually standard-mandated behaviou
by tonyarkles 8y ago
Javascript as well:
>> -2 % 2
-0
>> -3 % 2
-1
Edit: well, at least in Firefox JS. I have no idea if that's actually standard-mandated behaviour or if it's an implementation quirk. The -0 is especially weird (I had written odd but...)
- justin66 8y agoThis is pretty interesting. I don't use js but I took a quick look and apparently (x % 2) == 0 as a test for even integers should still work properly there, since a comparison of -0 and 0 will consider them equivalent.