4 ms·
I don't have an idea of how much it matters for which percentage of programs, but here are some anecdotes of what can happen when not caring about NaN and round
by stinos 9y ago
I don't have an idea of how much it matters for which percentage of programs, but here are some anecdotes of what can happen when not caring about NaN and rounding.
We had a bug once which was really hard to track down. Turned out a simple lack of initialization of a variable in a simple piece of code for a running average: the programmer reasoned in the first iteration this number is going to be multiplied with 0.0 anyway, so no need to initialize it. However because there are many NaN representations, once in a while the uninitialized memory of the variable happened to represent NaN, and NaN * 0.0 is still NaN, and that would keep on propagating, oops.
Likewise for rounding: we had some code calculating pixel positions and sometimes stuff was one pixel off resulting in weird visual artefacts. Turns out that when feeding the (faulty) rounding algorithm with results of some floating point calculations wouldn't do the expected thing but round down instead of up or so. Oops.