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
标签:python,ans1,decimal,0.2,0.1,Decimal From: https://www.cnblogs.com/louzetao/p/17212958.html
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
标签:python,ans1,decimal,0.2,0.1,Decimal From: https://www.cnblogs.com/louzetao/p/17212958.html