Python math.isfinite() Method
Example
Check whether a value is finite or not:
# Import math Library
import math
# Check whether some values are
finite
print (math.isfinite (56))
print
(math.isfinite (-45.34))
print (math.isfinite (+45.34))
print (math.isfinite (math.inf))
print (math.isfinite (float("nan")))
print (math.isfinite (float("inf")))
print (math.isfinite (float("-inf")))
print (math.isfinite (-math.inf))
Try it Yourself »
Definition and Usage
The math.isfinite()
method checks whether a value is
finite, or not. This method returns a Boolean value: True
if the value is
finite, otherwise False
.
Syntax
math.isfinite(x)
Parameter Values
Parameter | Description |
---|---|
x | Required. The value to check if it is finite or not |
Technical Details
Return Value: | A bool value, True if the value is
finite, otherwise False |
---|---|
Python Version: | Updated in Python 3.2 |