前言
一种关于浮点数据类型的顺序结构的信息。它包含低级别的精确度和内部特征的信息,这些值 用于在在C语言中的头文件float.h对应浮点型常量数据。
sys.float_info 运行信息
import sys
print(sys.float_info)
"""
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)
"""
sys float_info的宏
attribute | float.h macro | explanation |
---|---|---|
epsilon | DBL_EPSILON | difference between 1 and the least value greater than 1 that is representable as a float |
dig | DBL_DIG | maximum number of decimal digits that can be faithfully represented in a float; see below |
mant_dig | DBL_MANT_DIG | float precision: the number of base-radix digits in the significand of a float |
max | DBL_MAX | maximum representable finite float |
max_exp | DBL_MAX_EXP | maximum integer e such that radix**(e-1) is a representable finite float |
max_10_exp | DBL_MAX_10_EXP | maximum integer e such that 10**e is in the range of representable finite floats |
min | DBL_MIN | minimum positive normalized float |
min_exp | DBL_MIN_EXP | minimum integer e such that radix**(e-1) is a normalized float |
min_10_exp | DBL_MIN_10_EXP | minimum integer e such that 10**e is a normalized float |
radix | FLT_RADIX | radix of exponent representation |
rounds | FLT_ROUNDS | integer constant representing the rounding mode used for arithmetic operations. This reflects the value of the system FLT_ROUNDS macro at interpreter startup time. See section 5.2.4.2.2 of the C99 standard for an explanation of the possible values and their meanings. |