30 Sep
2018
30 Sep
'18
1:46 a.m.
Something to consider in all of this is that Python floats often *don't* produce NaNs for undefined operations, but raise exceptions instead:
1.0/0.0 Traceback (most recent call last): File "<stdin>", line 1, in <module> ZeroDivisionError: float division by zero
math.sqrt(-1.0) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: math domain error
So achieving the OP's goals would not only entail adding an integer version of NaN, but either making int arithmetic behave differently from floats, or changing the way float arithmetic behaves, to produce NaNs instead of exceptions. -- Greg