Signed Zero - Representations

Representations

The widely used two's complement encoding does not allow a negative zero. In a 1+7-bit sign-and-magnitude representation for integers, negative zero is represented by the bit string 1000 0000. In an 8-bit one's complement representation, negative zero is represented by the bit string 1111 1111. In all three encodings, positive zero is represented by 00000000.

In IEEE 754 binary floating point numbers, zero values are represented by the biased exponent and significand both being zero. Negative zero has the sign bit set to one. One may obtain negative zero as the result of certain computations, for instance as the result of arithmetic underflow on a negative number, or −1.0*0.0, or simply as −0.0.

In IEEE 754 decimal floating point encoding, a negative zero is represented by an exponent being any valid exponent in the range for the encoding, the true significand being zero, and the sign bit being one.

Read more about this topic:  Signed Zero