6 ms·
> It specifically does it for division through zero as if it wants to be a junior grade calculator just for this one thing. Not just division by zero. math.
by paulddraper 7mo ago
> It specifically does it for division through zero as if it wants to be a junior grade calculator just for this one thing.
Not just division by zero.
math.sqrt(-1)
math.log(-2)
are errors as well.
I agree that using both errors and float('nan') is odd.
Tbf, C mixes errors (for integers) and NaN (for floats).