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() |
Prev | Home | Next |
Z | Up | Zigzag() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |