Home >>Python cmath Module >Python cmath.isinf() Method

Python cmath.isinf() Method

Python cmath.isinf() Method

Python cmath.isinf() method in python is used to returns a Boolean value and checks whether a value is positive or negative infinity, or not. If the value is infinity it returns true, otherwise False.

Syntax:
cmath.isinf(x)

Parameter Values

Parameter Description
x It is a Required parameter used to check for infinity of the value
Here is an Example of Python cmath.isinf() Method:

import cmath
print (cmath.isinf(complex(6 + float('inf'))))
print (cmath.isinf(14 + 2j))

Output:
True
False
Example 2:

import cmath
print (cmath.isinf(complex(12 + float('inf'))))
print (cmath.isinf(10 + 5j))

Output:
True
False

No Sidebar ads