3 ms·
>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 expressi
by morningsam 2y ago
>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.
- MereInterest 2y agoTechnically, 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.