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

Python - cmath.inf



The Python cmath.inf is used to return a floating-point positive infinity. For negative infinity -cmath.inf can be used. It is equivalent to the output of float('inf').

Syntax

#New in version 3.6
cmath.inf

Parameters

No parameter is required.

Return Value

Returns a floating-point positive infinity.

Example:

The example below shows the usage of cmath.inf.

import cmath

#print the positive infinity
print(cmath.inf)

#print the negative infinity
print(-cmath.inf)

The output of the above code will be:

inf
-inf

❮ Python cMath Module

5