2011-01-01

Why computers have two zeros

Why computers have two zeros: +0 and -0

1/(+0.0) => +∞
1/(-0.0) => -∞

log(+0.0) => -∞
log(-0.0) => NaN

sqrt(+0.0) => +0.0
sqrt(-0.0) => -0.0

No comments:

Post a Comment