The cmath.isnan() function checks if the input argument is a NaN (Not a Number) value. NaN is a special floating-point value indicating that the result of a computation is undefined, unrepresentable, or not a number.

Syntax:
cmath.isnan(x)
copy
x The value(real or complex) to be tested. If the input value is a real number, it is first converted to a complex number before the operation.
Parameters:

The function returns True if is a NaN , False otherwise.

ExampleEdit & Run
import cmath

print(cmath.isnan(5))
print(cmath.isnan(float('nan')))
print(cmath.isnan(complex('nan')))
print(cmath.isnan(cmath.nan))
copy
Output:
False True True True [Finished in 0.010679115075618029s]