5
votes

I am curious as to, even 0 === -0, but 1/0 and 1/-0 give different results. So we can probably assume that 0 and -0 are represented differently in IEEE 754. How are they represented?

Update: so far, I can find some info on https://en.wikipedia.org/wiki/Signed_zero

and it seems that there are IEEE 754-1985 and IEEE 754-2008, and one form might be, in binary:

0 00000000 00000000000000000000000  as positive 0
1 00000000 00000000000000000000000  as negative 0

(the above is 32 bit, with the left most bit the sign bit, then to the right, 8 bit as exponent, and then 23 bit as the significand). But I can't find the different between the 1985 and 2008 version.

1
Wikpiedia did not help?Uwe Keim
of the 71kb wikipedia article, I searched for -0 but didn't find anything. I don't think for the fact that something can be found on the Internet or Wikipedia, it can't be a question on SOnonopolarity

1 Answers

1
votes

See:

IEEE 754-1985 on Wikipedia

IEEE 754-2008 on Wikipedia

and for the changes see the "IEEE 754 revision" page on Wikipedia.

Both 1985 and 2008 versions are using signed zero. They are represented as:

sign = 0 for positive zero, 1 for negative zero.

biased exponent = 0.

fraction = 0.

(exactly as you wrote in your question)

Edit: in both 1985 and 2008 version, 1/0 = infinity while 1/-0 = negative infinity.