Detecting nan and inf

N.E. Daynow panbru at comcast.net
Fri Aug 29 19:26:16 CEST 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