发布时间:2019-07-30 10:52:59编辑:auto阅读(2005)
计算高精确度的浮点数方法
借助decimal模块的”getcontext”和”Decimal”方法
from decimal import *
getcontext().prec = 50 #50精度
a = Decimal(1) / Decimal(3)
a
Decimal(‘0.333333333333……’)
上一篇: VIM PYTHON 调试
下一篇: Python 美化打印 json 数据
50507
49810
40411
37424
31846
28713
27640
22423
22422
20736
501°
1117°
912°
845°
1094°
969°
1584°
2948°
2629°
2021°