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

Python cmath.isfinite() Method

Python cmath.isfinite() Method

Python cmath.isfinite() method in python is used to return a Boolean value (true or false) and checks whether a given complex value is finite, or not.If the value is finite returns true, otherwise False.

Syntax:
cmath.isfinite(x)

Parameter Values

Parameter Description
x It is a Required parameter to check the value if it is finite or not
Here is an Example of Python cmath.isfinite() Method:

import cmath
print (cmath.isfinite(4 + 2j))
print (cmath.isfinite(complex(3.0,float('inf'))))
print (cmath.isfinite(float('inf')+ 3j))

Output:
True
False
False
Example 2:

import cmath
print (cmath.isfinite(5 + 2j))
print (cmath.isfinite(complex(5.0,float('inf'))))
print (cmath.isfinite(float('inf')+ 5j))

Output:
True
False
False

No Sidebar ads