PyDocs

Nav

Python Runtime Services

float_info

sys

data
A named tuple holding information about the float type. It contains low level information about the precision and internal representation. The values correspond to the various floating-point constants defined in the standard header file float.h for the ‘C’ programming language; see section 5.2.4.2.2 of the 1999 ISO/IEC C standard [C99], ‘Characteristics of floating types’, for details.
Members of float_info

d

dig
DBL_DIG -- maximum number of decimal digits that can be faithfully represented in a float

e

epsilon
DBL_EPSILON -- Difference between 1 and the next representable float

m

mant_dig
DBL_MANT_DIG -- mantissa digits
max
DBL_MAX -- maximum representable finite float
max_10_exp
DBL_MAX_10_EXP -- maximum int e such that 10**e is representable
max_exp
DBL_MAX_EXP -- maximum int e such that radix**(e-1) is representable
min
DBL_MIN -- Minimum positive normalized float
min_10_exp
DBL_MIN_10_EXP -- minimum int e such that 10**e is a normalized float
min_exp
DBL_MIN_EXP -- minimum int e such that radix**(e-1) is a normalized float

r

radix
FLT_RADIX -- radix of exponent
rounds
FLT_ROUNDS -- rounding mode used for arithmetic operations
1 Example
>>> import sys
>>> sys.float_info.dig
15
>>> s = '3.14159265358979'    # decimal string with 15 significant digits
>>> format(float(s), '.15g')  # convert to float and back -> same value
'3.14159265358979'
from the Python docs
See Also
No see-alsos for sys/float_info
0 Notes
No notes for float_info