What is the range of values a float can have in Python?

Viewed 79136

What are its smallest and biggest values in python?

6 Answers

Technically speaking, the smallest float is -inf and the max float inf:

>>> (float('-inf')            #   negative infinity 
< -1.7976931348623157e+308    #*  smallest float that is not negative infinity 
< -4.9406564584124654e-324    #*  biggest negative float that is not zero
< 0                           #   zero duh
< 4.9406564584124654e-324     #*  smallest positive float that is not zero
< 1.7976931348623157e+308     #*  biggest float that is not positive infinity
< float('inf'))               #   positive infinity
True

numbers with * are machine-dependent and implementation-dependent.

Related