The maximum float value in Python is 1.7976931348623157e+308. To find the max float in Pythoon, we can use the sys module and access the float_info property.

import sys

print(sys.float_info)

#Output:
sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)

When working with numbers in any programming language, knowing the min and max values can be useful so you don’t raise any errors in your code.

For floating point numbers in Python, the maximum value can be found through the sys module.

We access the float_info property from the sys module and can see the maximum floating point value for Python.

import sys

print(sys.float_info)

#Output:
sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)

As shown above, the max float value possible in Python is 1.7976931348623157e+308.

The Minimum Float Value in Python

From the float_info property of the sys module, we can also get the minimum float value in Python. As we can see in the code output from above, the minimum float value in Python is 2.2250738585072014e-308.

Hopefully this article has been useful for you to find the maximum float value in Python.

Categorized in:

Python,

Last Update: February 26, 2024