Python Tutorial Python Advanced Python References Python Libraries

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