Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It is the only integer (and, in fact, the only real number) that is neither negative nor positive.

Yet in the IEEE 754 standard there is both a negative and a positive zero. They produce "true" when compared for equality but they usually produce differently signed infinities when divided by.



That makes complete sense when you consider that IEEE 754 is all about approximating values, though. It is possible that the value you're trying to represent is smaller than the smallest values actually representable by IEEE 754 floating point, but it would be nice if you could at least preserve the sign information (so that, as you point out, dividing produces the correct `Inf` value).

The real WTF in IEEE 754 is why there needs to be so many different ways to represent NaN.


What other way is there than all ones exponent and non-zero significand?


I think parent meant the many different ways to be non-zero.


Just as there are many different ways for a number to be negative.


Signed zero is crucial for handling branch cuts in complex functions - http://port70.net/~nsz/articles/float/kahan_branch_cuts_comp...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: