更新时间:2023-11-10 10:33:28
简单的答案:浮动使用有限精度的二进制编码来表示数字,所以各种操作都会丢失一些精度。
***页面有很多信息(可能太多)。
Possible Duplicate:
Python float - str - float weirdness
Python float division does not appear to have accurate results. Can someone explain why?
>>>3.0/5
0.59999999999999998
Short answer: Floats use finite-precision binary encoding to represent numbers, so various operations lose some precision.
The Wikipedia page has a lot of information (maybe too much).