去google了一下,strictfp 基本上就是 strict float point的简写了。
JVM Spec 中内容如下 :
2.18 FP-strict Expressions
If the type of an expression is float or double, then there is a question as to what value set (§2.4.3) the value of the expression may be drawn from. This is governed by the rules of value set conversion (§2.6.6); these rules in turn depend on whether or not the expression is FP-strict.Every compile-time constant expression is FP-strict. If an expression is not a compile-time constant expression, then consider all the class declarations, interface declarations, and method declarations that contain the expression. If any such declaration bears the strictfp modifier, then the expression is FP-strict.
It follows that an expression is not FP-strict if and only if it is not a compile-time constant expression and it does not appear within any declaration that has the strictfp modifier.
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.
455

被折叠的 条评论
为什么被折叠?



