It turns out +0 === -0
evaluates to true
despite +0
and -0
being different entities. So, how do you differentiate +0
from -0
?
There is a hack:
if (1 / myZero > 0) {
// myZero is +0
} else {
// myZero is -0
}
Can I do better?
question from:https://stackoverflow.com/questions/7223717/differentiating-0-and-0