This tutorial will demonstrate this method to determine the max
float value you can store in Python.
float Value With the
sys.float_info in Python
In Python, we can use the
sys.maxint function inside the built-in
sys module to find out the maximum value that can be stored in an integer variable. We can also use the same
sys module to find out the maximum value that can be stored inside a
float variable with the
sys.float_info is a tuple that holds useful information about the
float data type in Python.
sys.float_info.max gives us the largest value that can be stored inside a
float variable. The following program snippet shows us how to use the
sys module to find the maximum value that can be stored inside a
import sys sys.float_info.max
We found out the maximum value that a float variable can hold with the
sys.float_info.max in the code above. The output shows that the upper limit of a float variable is 1.7976931348623157e+308.