当代码被编译或者解释运行时,“0.1”已经被近似转化为这种形式下最接近的一个浮点数,这导致在计算还没有真正开始之前,一个微小的舍入误差就已经存在了。
When the code is compiled or interpreted, your "0.1" is already rounded to the nearest number in that format, which results in a small rounding error even before the calculation happens.
在许多情况下,舍入误差是可以控制的,即使在很复杂的计算,使得上部6 - 8位小数是正确的。
In many cases, the round-off error can be managed, even over really complex computations, such that the top 6-8 decimal places are correct.
这种情况下,超时应向上舍入到可能的最小超时。
In this case, the time-out should be rounded up to the minimum time-out possible.
应用推荐