且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

比较两个浮筒

更新时间:2022-11-17 13:53:34

看看这里: HTTP: //floating-point-gui.de/errors/comparison/

由于舍入误差,最浮点数最终被
  稍微IM precise。只要这个IM precision留小,它可以
  通常被忽略。的然而,这也意味着,数字预期为
  相等(例如计算通过不同的正确相同的结果时,
  方法)经常略有不同,和一个简单的平等的测试失败

Due to rounding errors, most floating-point numbers end up being slightly imprecise. As long as this imprecision stays small, it can usually be ignored. However, it also means that numbers expected to be equal (e.g. when calculating the same result through different correct methods) often differ slightly, and a simple equality test fails.

和,当然,什么每个计算机科学家应该知道关于浮点运算