Hacker News new | ask | show | jobs
by jckarter 5600 days ago
There are lots of edge cases where the sign of zero affects computation. In floating-point, zero values represent not only the exact value zero but the result of an underflowed computation too small to represent as a non-zero floating point value, so retaining the sign is often important to at least keep such computations on the correct side of a branch cut or limit. For example:

x/+0 = +infinity

x/-0 = -infinity

sqrt(+0) = 0

sqrt(-0) = nan

log(+0) = -infinity

log(-0) = nan