Terry J. Reedy added the comment:
+-infinity and nans were created for reasons that do not apply to standard
python. In Fortran, C, etcetera, float arrays can only contain floats (hence
calling a non-number a float) and continuing a computation after numerical
error is more difficult or impossible. So something as simple as the following
is not possible.
<initialize 1000 x 1000 data array>
for time in range(1, 1000):
for x in range(1000):
for y in range(1000):
try:
data[x][y] = <update>
except Exception as e:
data[x][y] = None # will propagate just like NaNs!
I think we might be better with two consistently behaving float classes: proper
Python floats with no inf or nan, just exceptions; and ieee floats, similar to
Decimals, with as complete implementation of the ieee standard as possible,
including various nan types and access to FPU flags. What we have now is a
compromise that I doubt is truly satisfactory to anyone.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18570>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com