python3 float 计算

 

>>> a=0.1
>>> b=0.2
>>> c=a+b
>>> c
0.30000000000000004
>>> from decimal import Decimal
>>> c=Decimal(str(a))+Decimal(str(b))
>>> float(c)
0.3
>>>

posted @ 2018-10-08 17:53  EngineTang  阅读(1424)  评论(0编辑  收藏  举报