a = 4.2
b = 2.1
a + b
(a+b) == 6.3
输出结果:解决方法:
from decimal import Decimal
a = Decimal('4.2')
b = Decimal('2.1')
a + b
print(a + b)
(a + b) == Decimal('6.3')
输出结果:a = 4.2
b = 2.1
a + b
(a+b) == 6.3
输出结果:解决方法:
from decimal import Decimal
a = Decimal('4.2')
b = Decimal('2.1')
a + b
print(a + b)
(a + b) == Decimal('6.3')
输出结果: