NaN handling

Robert Kern robert.kern at gmail.com
Sat May 6 15:15:33 EDT 2006


Felipe Almeida Lessa wrote:
> 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')

Have you tried it on Windows?

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list