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

>In the context of getting one by surprise in simple arithmetic they are approximately as bad as zero.

I don't think so, because getting 0 in a larger expression might yield a result that looks plausible, leading to hidden bugs. Inf and NaN both are good because they necessarily propagate all the way up to the end result, making it obvious that something went wrong.



Technically, it is possible for floating-point Inf to stop propagating prior to the final result, depending on the operation. For example, 1/Inf produces zero, as does exp(-Inf).

But those are cases where the larger a value is, the less is contributes to the final value.




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

Search: