Assuming IEEE 754 representation, float32 has a 24-bit significand precision, while float64 has a 53-bit significand precision (except for “denormal” numbers).

In order to represent a number with an absolute error of at most 0.001, you need at least 9 bits to the right of the binary point, which means the numbers are rounded off to the nearest multiple of 1/512, thus having a maximum representation error of 1/1024 = 0.0009765625 < 0.001.

With 24 significant bits in total, and 9 to the right of the binary point, that leaves 15 bits to the left of the binary point, which can represent all integers less than 215 = 32768, as you have experimentally determined.

However, there are some numbers higher than this threshold that still have an error less than 0.001. As Eric Postpischil pointed out in his comment, all float64 values between 32768.0 and 32768.001 (the largest being exactly 32768+137438953/237), which the float32 conversion rounds down to exactly 32768.0, meet your accuracy requirement. And of course, any number that happens to be exactly representable in a float32 will have no representation error.

Answer from dan04 on Stack Overflow
🌐
Reddit
reddit.com › r/learnpython › how do i get max value of np.float32?
How do I get max value of np.float32? : r/learnpython
March 31, 2021 - The maximum value of a float32 is infinity. ... You're not wrong Walter. You're just an asshole. ... Not in theory, there is a literal value of infinity that can be encoded as a float. ... I'm 37 and looking for a complete career change. ... Started MOOC 2026 Python Programming today Module ...
🌐
Note.nkmk.me
note.nkmk.me › home › python
Maximum and Minimum float Values in Python | note.nkmk.me
August 11, 2023 - You can obtain the maximum representable float value with sys.float_info.max. e+XXX means 10 to the power of XXX.
Discussions

floating point - What is the maximum float in Python? - Stack Overflow
The maximum integer in Python 2 is available by calling sys.maxint. What is the maximum float or long in Python? See also: Maximum and Minimum values for ints. More on stackoverflow.com
🌐 stackoverflow.com
python - For a given precision, what is the maximum value for which a float32 will give the same result as a float64? - Stack Overflow
As Eric Postpischil pointed out ... float64 values between 32768.0 and 32768.001 (the largest being exactly 32768+137438953/237), which the float32 conversion rounds down to exactly 32768.0, meet your accuracy requirement. And of course, any number that happens to be exactly representable in a float32 will have no representation error. ... 32768 is not the maximum, though; all ... More on stackoverflow.com
🌐 stackoverflow.com
Finding max value in a series of floats
I am trying to write code that takes a row of floats from a csv file, representing the average temperature in a given month over the course of 70 years, and returns the highest float value of them all. When I print the variable holding the float values, in this case val, I get something similar ... More on discuss.python.org
🌐 discuss.python.org
11
0
April 15, 2024
floating point - What is the range of values a float can have in Python? - Stack Overflow
What are its smallest and biggest values in python? More on stackoverflow.com
🌐 stackoverflow.com
🌐
Python⇒Speed
pythonspeed.com › articles › float64-float32-precision
The problem with float32: you only get 16 million values
February 1, 2023 - We only have 16 million values at a $1,000,000 precision, so the maximum value we can represent accurately at this level of precision is $16 trillion, or slightly less than the 2022 US GDP of about $25 trillion.
🌐
Stack Overflow
stackoverflow.com › questions › 3477283 › what-is-the-maximum-float-in-python
floating point - What is the maximum float in Python? - Stack Overflow
The maximum integer in Python 2 is available by calling sys.maxint. ... See also: Maximum and Minimum values for ints.
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › find maximum float value in python
Find Maximum Float Value in Python - Spark By {Examples}
May 31, 2024 - How to find the maximum float value in Python? You can find the maximum value of the float data type using the sys.float_info module or the finfo()
🌐
TutorialsPoint
tutorialspoint.com › What-is-the-maximum-value-of-float-in-Python
What is the maximum value of float in Python?
Let's see what happens when we ... print("OverflowError occurred!") ... Python's maximum float value is approximately 1.798 × 10308, accessible via sys.float_info.max....
🌐
W3Resource
w3resource.com › python-interview › what-is-the-maximum-and-minimum-value-for-an-int-float-and-string-data-type-in-python.php
Exploring data type limits in Python
August 12, 2023 - On most platforms, the minimum positive nonzero value is approximately 2.2250738585072014e-308, and the maximum value is approximately 1.7976931348623157e+308. Python's float data type has 15-17 decimal digits of precision.
Find elsewhere
🌐
DEV Community
dev.to › frankkk › python-tips-floatinf-269h
Python Tips- Maximum Value float('inf') - DEV Community
February 3, 2024 - But sys.maxsize is not the max ... True >>> b > float('inf') False · So, if you want to know why the Integer (int) has no max limit in Python, you need read the source code, the int object is with variable size...
🌐
Python.org
discuss.python.org › python help
Finding max value in a series of floats - Python Help - Discussions on Python.org
April 15, 2024 - I am trying to write code that takes a row of floats from a csv file, representing the average temperature in a given month over the course of 70 years, and returns the highest float value of them all. When I print the variable holding the float values, in this case val, I get something similar to: 10.56 12.35 11.35 etc.
🌐
TutorialsPoint
tutorialspoint.com › article › get-the-machine-limits-information-for-float-types-in-python
Get the Machine limits information for float types in Python
float16 limits: Minimum: -65500.0 Maximum: 65500.0 Precision: 3 digits float32 limits: Minimum: -3.4028235e+38 Maximum: 3.4028235e+38 Precision: 6 digits float64 limits: Minimum: -1.7976931348623157e+308 Maximum: 1.7976931348623157e+308 Precision: ...
🌐
Finxter
blog.finxter.com › home › learn python blog › integer and float maximums in python’s max() function
Integer and Float Maximums in Python's Max() Function - Be on the Right Side of Change
September 15, 2019 - print(max([5, 10, 10.0])) # 10 print(max([5, 10.0, 10])) # 10.0 · It simply returns the highest value in an iterable. Note that many advanced coders worry that we cannot compare an int with a float because of limited floating point precision because they know the following example: print(0.3+0.3+0.3 == 0.9) # False print(0.3+0.3+0.3) # 0.8999999999999999 · This is not an issue when comparing integers with “integer-like” floats. Python floats can represent integers perfectly fine.
🌐
GeeksforGeeks
geeksforgeeks.org › python-min-max-value-in-float-string-list
Python | Min/Max value in float string list - GeeksforGeeks
April 8, 2023 - The minimum value and maximum value are printed using the variables min_val and max_val respectively. ... # Python3 code to demonstrate working of # Min / Max value in float string list # using numpy import numpy as np # initialize list test_list = ['4.5', '7.8', '9.8', '10.3'] # convert the list of string elements to a numpy array of float elements float_arr = np.array(test_list, dtype=float) # get the minimum and maximum values from the array min_val = np.min(float_arr) max_val = np.max(float_arr) # printing result print("The min value of list : " + str(min_val)) print("The max value of list : " + str(max_val))
🌐
Wikipedia
en.wikipedia.org › wiki › Single-precision_floating-point_format
Single-precision floating-point format - Wikipedia
July 31, 2026 - Single-precision floating-point ... FP32, float32, or float) is a computer number format, usually occupying 32 bits in computer memory; it represents a wide range of numeric values by using a floating radix point. A floating-point variable can represent a wider range of numbers than a fixed-point variable of the same bit width at the cost of precision. A signed 32-bit integer variable has a maximum value of 231 ...
🌐
w3resource
w3resource.com › python-exercises › python-basic-exercise-123.php
Python: Determine the largest and smallest integers, longs, floats - w3resource
May 17, 2025 - Float value information: sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250 738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2 , rounds=1) Integer ...
🌐
Reddit
reddit.com › r/askprogramming › why is the max value of a 32 bit floating point number 3.4 x 10^38?
r/AskProgramming on Reddit: Why is the max value of a 32 bit floating point number 3.4 x 10^38?
August 28, 2021 -

I understand 2x - 1 gives you the max number for x unsigned bits. but say we're using IEEE-754 32 bit floating point number. Shouldn't the maximum value be 10256 x 223? since the mantissa is a 23 bit number and the exponent is 10 raised to the power of an 8 bit number.

Wikipedia however says the (2 − 2−23 ) × 2127

where does this come from? Why is the exponent negative?

Top answer
1 of 2
3
Quick correction: the exponent is base 2, not base 10. An exponent of 0xFF would indicate a special value like an infinity or NAN, so the largest exponent would indeed be 127, hence 2127. As far as the mantissa, it should be remembered that it's actually 24 bits. It's just that because we're working in binary, we know that the first digit is always 1 (since the leading digit has to be non-zero and in binary there's only one other digit: 1), so we don't have to explicitly store it. So it's 23 explicit bits plus the one implicit leading 1 (which is 0 when the exponent is 0x00). Either way, the largest mantissa is one where all the bits are set so it's value would be: 1 (implicit bit) + 1/2 (first explicit bit) + 1/4 (second explicit bit) + ... up until the last explicit bit. This would be roughly 1.99999988079071044921875, but this could be more tersely represented as 2 − 2-23 . The 2-23 or 1/(223 ) is just the gap of between 2 and 1.99999988079071044921875. Multiply the two together, and you get Wikipedia's answer. I suggest you play around with this site. It's pretty handy for exploring the format.
2 of 2
3
but say we're using IEEE-754 32 bit floating-point number This consists of: 1 sign bit 8 exponent bits an implicit leading 1 mantissa bit (not part of the representation itself) 23 mantissa bits To represent a positive number, we need a 0 sign bit. The largest exponent value, 11111111₂, is reserved for NaN values. The next largest, 11111110₂, corresponds to the exponent +127. The largest mantissa value is 1.11111111111111111111111₂. I have included the implicit leading 1 here, even though it's not part of the floating-point representation itself. This corresponds to the value 1.99999988079071044921875. Putting this altogether, we get the largest representable 32-bit floating-point number to be (-1)⁰ × 2⁺¹²⁷ × 1.99999988079071044921875 = 34028234663852885981170418348451692544​0.
🌐
Note.nkmk.me
note.nkmk.me › home › python
Integer (int) Has No Max Limit in Python 3 | note.nkmk.me
January 27, 2024 - Python 2 has two integer types, int and long, whereas Python 3 has only int. The int in Python 3 is equivalent to the long in Python 2, with no max limit. ... For information on the max and min float values, refer to the following article.