gpt4 book ai didi

java - java中Strictfp是什么意思?

转载 作者:行者123 更新时间:2023-11-30 03:43:10 26 4
gpt4 key购买 nike

如果有人能用一个例子和一个很好的解释来解释什么是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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com