Twos complement in floating point numbers.
I was playing around with floating point numbers and noticed that under IEEE 754 there were two possible values of zero, a negative zero and a positive one. As far as I can tell there is no reason why we can't use twos complement to represent negative floating point numbers such that we avoid that oddness.
Other than making the determination of absolute values a bit more difficult, not the significand + 1 to the lest significant bit, is there a reason why I can't find any implementations that use this?
Also is there a good book/paper/textbook I can read on this?
Posted May 28, 2015, 8:03 AM UTC
A "good" reason for having positive zero and negative zero is for handling 1.0/0.0. In floating point arithmetic, this does not raise an exception but returns infinity. The sign of the infinity being the product of the signs, therefore 1.0/(+0.0) is +infinity but 1.0/(-0.0) is -infinity.
I've always seen this as a way to handle limits with floating point numbers.