我的百分比计算总是打印为结果:0E-14
而不是0.000037488
代码:
import decimal
firstvalue = 3.0233 # (%)
amount = 0.00310000
firstcal = decimal.Decimal(firstvalue)
firstcalresult = (firstcal / 100) * amount
Result is 0.00009372230000, it works fine
percentage = 40
feepercent = firstcalresult
feepercentresult = (percentage / 100) * feepercent
百分比=0.00009372230000
Result is 0E-14, but must be 0.000037488
为什么第一次计算有效而第二次计算无效?我也尝试过decimal.Decimal
,但结果相同。有什么想法吗?你知道吗
以下是没有任何错误的完整解决方案:
您得到的解决方案是:
已解决:
给我正确的结果。你知道吗
相关问题 更多 >
编程相关推荐