Check whether a value is finite or not:
# Import math Library
import math
# Check whether the values are finite or not
print(math.isfinite(2000))
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))
print(math.isfinite(0.0))
Try it Yourself » Definition and UsageThe math.isfinite()
method checks whether a number is finite or not.
This method returns True if the specified number is a finite number, otherwise it returns False.
Syntax Parameter Values Parameter Description x Required. The value to check. Must be a number (float/integer/infinite/NaN/finite) Technical Details Return Value: Abool
value, True if x is finite, False if x is either an infinity or a NaN Python Version: New in Python 3.2
Track your progress - it's free!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4