python

1 ans1=0.1+0.2
2 print(f'0.1+0.2={ans1}')
3 
4 import decimal
5 
6 ans2=decimal.Decimal('0.1')+decimal.Decimal('0.2')
7 print(f'0.1+0.2={ans2}')
View Code

 

posted @ 2023-03-13 21:24  娄泽涛  阅读(10)  评论(0)    收藏  举报