`float('nan')`

results in Nan (not a number). But how do I check for it? Should be very easy, but I cannot find it.

Return

`True`

if x is a NaN (not a number), and`False`

otherwise.

```
>>> import math
>>> x = float('nan')
>>> math.isnan(x)
True
```

The usual way to test for a NaN is to see if it's equal to itself:

```
def isNaN(num):
return num != num
```

Licensed under: CC-BY-SA with attribution

Not affiliated with: Stack Overflow