Python Basic - sys.float_info

前言

一種關於浮點數據類型的順序結構的信息。它包含低級別的精確度和內部特徵的信息,這些值 用於在在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.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章