print float(lastpayment)-temp,'and',float(self.pyament)
if (float(lastpayment)-temp) == float(self.pyament):
print "success: "+self.pyament+" == "+tempStr
else:
print "failed: "+self.pyament+" == "+tempStr
代码如上。
结果如下:
1602.7 and 1602.7
failed: 1602.7 == 4059.5+-37.7+-1565.0
float(lastpayment)-temp和float(self.pyament)打印出来都是1602.7
为什么不是相等的?
是python对于float类型有别的比较方法吗?
偶然的你
皈依舞