test for nan

John Hunter jdhunter at ace.bsd.uchicago.edu
Tue Mar 30 22:24:57 CEST 2004


I have a C extension module that is returning some doubles.  When the
doubles get out of range, the numbers print as 'nan'.

Is there a better way to test for NaN than

   str(p1)=='nan'

where p1 is a float?

python2.3

Thanks,
John Hunter




More information about the Python-list mailing list