NaN handling

Felipe Almeida Lessa felipe.lessa at gmail.com
Sat May 6 17:28:47 CEST 2006


Em Sex, 2006-05-05 às 16:37 -0400, Ivan Vinogradov escreveu:
> This works to catch NaN on OSX and Linux:
> 
> # assuming x is a number
> if x+1==x or x!=x:
> 	#x is NaN

This works everywhere:

nan = float('nan')

.
.
.

if x == nan:
    # x is not a number

-- 
Felipe.




More information about the Python-list mailing list