Maximum Value of Float in Python



In Python, floating-point numbers can be implemented using double-precision, i.e., 64-bit format, as per the IEEE 754 standard. These floats have a finite range and precision.

The maximum value that a float can represent depends on the platform that we are using, but can be accessed using the sys.float_info attribute.

Maximum Value of Float using sys.float_info

The sys.float_info object provides details about the float implementation on the current platform. The attribute float_info.max gives the largest positive floating-point number representation.

Example

Here in this example, we are going to use float_info.max attribute from the sys.float_info object to get the maximum float value in Python -

import sys

# Get the maximum float value
print("Maximum float value:", sys.float_info.max)

Here is the output of the above program -

Maximum float value: 1.7976931348623157e+308

Maximum value of Float using float_info.max

The sys.float_info object provides various constants related to the float type. Some commonly used attributes are as follows -

  • max: Maximum representable positive finite float.
  • min: Minimum positive normalized float.
  • epsilon: Difference between 1 and the smallest representable float greater than 1.

Example

In this example, we are using the other float attributes to print respective values -

import sys

print("Maximum float value:", sys.float_info.max)
print("Minimum positive normalized float:", sys.float_info.min)
print("Float epsilon:", sys.float_info.epsilon)

Here is the output of the above example -

Maximum float value: 1.7976931348623157e+308
Minimum positive normalized float: 2.2250738585072014e-308
Float epsilon: 2.220446049250313e-16
Updated on: 2025-05-29T05:15:31+05:30

778 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements