Home >>Python cmath Module >Python cmath.isnan() Method

Python cmath.isnan() Method

Python cmath.isnan() Method

Python cmath.isnan() method in python is used to return a Boolean value(true or false) and to checks whether a value is nan (Not a Number), or not. If the value is Nan returns True otherwise False

Syntax:
cmath.isnan(x)

Parameter Values

Parameter Description
X It is a Required parameter used to check for NaN value
Here is an Example of Python cmath.isnan() Method:

import cmath
print (cmath.isnan(15 + float('nan')))
print (cmath.isnan(5 + 4j))

Output:
True
False
Example 2:

import cmath
print (cmath.isnan(8 + float('nan')))
print (cmath.isnan(2 + 7j))

Output:
True
False