Today I learned that NaNs and infinites may slow down programs significantly. So instead of
// some computation that produce NaN when arg == 0
if(arg == 0) // special case
result = 0;
one should write
if(arg == 0)
result = 0; // special case
else
// some computation that produce NaN when arg == 0