Differentiating +0 and -0
This is still some kind of hack, but a look at the specs suggests this:
Math.atan2(0, -0) === Math.PI // true
Math.atan2(0, 0) === 0 // true
In ECMAScript 6 Object.is
behaves like ===
except that it distinguishes positive and negative zeroes, and Object.is(NaN, NaN)
evaluates to true
. (See here for a writeup.)
Chrome 24 supports Object.is
.