Skip to content Skip to sidebar Skip to footer

What Is The Purpose Of Having Both Positive And Negative Zero (+0, Also Written As 0, And -0)?

According to the ECMAScript 6.0 specification: ...there is both a positive zero and a negative zero. For brevity, these values are also referred to for expository purposes by the

Solution 1:

It's a matter of how numbers are stored and represented in the memory, and processed, specially for floating point arithmetic.

Signed zero is zero with an associated sign. In ordinary arithmetic, −0 = +0 = 0. However, in computing, some number representations allow for the existence of two zeros, often denoted by −0 (negative zero) and +0 (positive zero). This occurs in some signed number representations for integers, and in most floating point number representations. The number 0 is usually encoded as +0, but can be represented by either +0 or −0.

More in this previous answer

Post a Comment for "What Is The Purpose Of Having Both Positive And Negative Zero (+0, Also Written As 0, And -0)?"