Detecting nan and inf

N.E. Daynow panbru at comcast.net
Fri Aug 29 13:26:16 EDT 2003


Are there better ways than the following to determine whether a float is 
nan or inf?

     strg=val.__repr__()
     if strg=='nan' or strg=='inf':
         ** do something **

where 'val' is the float.

Tim





More information about the Python-list mailing list