Zero value (Definition)

ECMAScript interpreters must be able to distinguish between +0 and -0.

Availability:

ECMAScript edition - 2
Property/method value type:Number primitive

In the real world, Zero is Zero is Zero. Inside a JavaScript interpreter, certain calculations (most notably Math.pow() functions) require the sign of the zero value to be taken into account.

Internally, an ECMA compliant interpreter must be able to distinguish between +0 and -0 although from a mathematical standpoint the values are identical. Where calculations involve the likelihood of +infinity and -infinity, the sign can affect the outcome, and so can the sign of the zero value. For example the reciprocal of a very small number.

We have quietly ignored the sign of a zero value where it would make no difference. There are some discussions where it becomes important and so the sign is retained here for illustrative purposes.

See also:Infinity, Math.pow()

Cross-references:

ECMA 262 edition 2 - section - 8.5

ECMA 262 edition 3 - section - 8.5