pop*_*eds 5 python floating-point
python中可以表示的最小数字是多少?
我见过小2.05623357236e-296但可以有更小的吗?
>>> import sys
>>> 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)
来自文档
Run Code Online (Sandbox Code Playgroud)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=2.2250738585072014e-308
检查sys.float_info.min.请注意,这是最小标准化值; 最小非正规化值可能更小,但数值精度将受到影响.
对于通常的64位浮点数,标准化的最小值约为2.2e-308.非规范化的min可以少得多,直到4.94e-324:
>>> 5e-324
4.9406564584124654e-324
值得指出的是,decimal模块的Decimal类型可以代表任意小的数字,仅受可用内存的限制.
| 归档时间: | 
 | 
| 查看次数: | 5127 次 | 
| 最近记录: |