15095418534 发表于 2019-5-7 20:51:31

Python判断两个值是否相等,大概是通过减法来实现的吧

判断两个值是否相等时,会做减法,当差在一定范围内,就判定两个值相等。所以就会出现这种情况:
1 != 1.0000000000000000000000000000000000000000000000002164
运行结果为:
>>>False
1 == 1.000000000000000000000000000000000000000000000000000000565461
>>>True
{:9_230:}
页: [1]
查看完整版本: Python判断两个值是否相等,大概是通过减法来实现的吧