如果有人能用一个例子和一个很好的解释来解释什么是java中的strictfp,那就太好了。 我已经在互联网上搜索过,但仍然无法获得相同的明确解决方案 预先感谢:)
最佳答案
explanation given by the JLS看起来很清楚:
Within an FP-strict expression, all intermediate values must be elements of the float value set or the double value set, implying that the results of all FP-strict expressions must be those predicted by IEEE 754 arithmetic on operands represented using single and double formats.
Within an expression that is not FP-strict, some leeway is granted for an implementation to use an extended exponent range to represent intermediate results; the net effect, roughly speaking, is that a calculation might produce "the correct answer" in situations where exclusive use of the float value set or double value set might result in overflow or underflow.
有关何时可以使用 strictfp
的讨论,请参阅 When should I use the "strictfp" keyword in java?
关于java - java中Strictfp是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26366463/