NaN handling

Alexander Schmolck a.schmolck at gmail.com
Sat May 6 11:36:33 EDT 2006


Felipe Almeida Lessa <felipe.lessa at gmail.com> writes:

> 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

No it doesn't.

'as



More information about the Python-list mailing list