为什么python最后要加1? console.log(9.89+3.48) = 13.37000000000001

Why did python add 1 at the end? console.log(9.89+3.48) = 13.37000000000001

https://i.imgur.com/YYNhvNv.png

它在该控制台日志输出的末尾添加了 1。为什么? 答案应该只有 13.37

可能是因为它增加了 double 类型的数字(不过我不是 Python 专家,所以我可能是错的)。 double 类型,很像 single 没有完美的精度。因此可能会出现一些小数错误...