0.1 + 0.7 != 0.8
为什么在某些编程语言中标题中的表达式计算结果为 true?我已经在 php、ruby 和 python 中尝试过了。
Why in some programming languages the expression in title evaluates to true? I've tried it in php, ruby and python.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请阅读
每个程序员应该了解的浮点运算知识
。Please read
What Every Programmer Should Know About Floating-Point Arithmetic
.由于浮点数的内部解释,它们并不完全等于您所写的内容。
Because of internal interpretation of floating-point numbers, they do not exactly equal to what you have wrote.