Python isinf() Function

isinf() function exists in Standard math Library of Python Programming Language and is used to determine whether a specific number is an infinite number or not.

Syntax of isinf()

The syntax of isinf() function in python is:
math.isinf( x )


Parameters of isinf()

x Any valid Python number (positive or negative). This parameter is required.
Note: if the x parameter is not a number, isinf() function will return an error.


Python isinf() Function Compatibility

Python 2.x – Yes
Python 3.x – Yes


Return Value of isinf()

The return value of isinf() function is either True or False.

If parameter x is infinite, isinf() function returns True.
If Parameter x is neither an infinity nor a NaN (Not a Number in computing), isinf() returns False.


Python isinf() Function Example

Output of Python isinf() function: