说实话我也不太清楚不过看看这个也许明白一些,可惜我的英语太差了!_!Unlike some of the numeric functions of class StrictMath, all implementations of the equivalent functions of class Math are not defined to return the bit-for-bit same results. This relaxation permits better-performing implementations where strict reproducibility is not required. By default many of the Math functions simply delegate to the equivalent functions in StrictMath for their implementations. Code generators are encouraged to use platform-specific native libraries or microprocessor instructions, where available, to provide higher-performance implementations of Math functions. Such higher-performance implementations still must conform to the specification for Math.
-----------------------------------------------------------
我的英语也不怎么样,说实话,刚才那段话,我已经研究半天了,就是没搞明白。
对于什么“计算机浮点单元的例程”,和“自由分布数学库”(fdlibm),偶一点都没听说过啊。就是说 Math 会出现不同平台下不同结果的情况,但是速度比较快,StrictMath正好相反,是吗?再请问一个问题:
我测试Math.round() 方法时,round(-1.5)得出结果竟然是-1,为什么不是-2呢?