NaN again - and IEEE arithmatics
Huaiyu Zhu
hzhu at rocket.knowledgetrack.com
Fri May 12 15:28:07 EDT 2000
Sometime ago I asked about reading back from a file containing arrays with
NaN as elements. Someone kindly suggested
>>> from math import exp
>>> NaN = exp(1000)/exp(1000)
>>> NaN
nan
However this breaks in 1.6 (or maybe because it is installed on another
machine).
>>> import math
>>> NaN = math.exp(1000) / math.exp(1000)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: math range error
Any suggestion of how to deal with it in this case? Is there a generic way?
If I understand correctly, NaN is a standard feature in IEEE floating point
arithmatics. So why isn't there a predefined class or object for NaN? It
might go into the math or Numeric module, I think.
Thanks
--
Huaiyu Zhu hzhu at knowledgetrack.com
More information about the Python-list
mailing list