Python Tutorial Python Advanced Python Resources Python Libraries
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

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

5