Python Tutorial Python Advanced Python References Python Libraries

Python cmath - nan



The Python cmath.nan is used to return a floating-point "not a number" (NaN) value. It is equivalent to the output of float('nan').

Syntax

#New in version 3.6
cmath.nan

Parameters

No parameter is required.

Return Value

Returns a floating-point "not a number" (NaN) value.

Example:

The example below shows the usage of cmath.nan.

import cmath

#print the value of nan
print(cmath.nan)

The output of the above code will be:

nan

❮ Python cMath Module