Is -0 a number?
Reproducing an old answer of mine from Quora.
Is -0 a number? Yes it is, and it is equal to 0.
Interestingly though, signed zeros are a necessary representation in computing because of rounding off errors and limitations with floating point precision. In certain classes of computations, the sign of a number before it was rounded off to zero is of practical importance.
Here’s an example from the Wikipedia article on signed zeros:
Informally, one may use the notation “−0” for a negative value that was rounded to zero. This notation may be useful when a negative sign is significant; for example, when tabulating Celsiu temperatures, where a negative sign means below freezing.
Comments