strictfp

Does Java strictfp modifier have any effect on modern CPUs?

独自空忆成欢 提交于 2019-12-28 14:57:31
问题 I know the meaning of the strictfp modifier on methods (and on classes), according to the JLS: JLS 8.4.3.5, strictfp methods: The effect of the strictfp modifier is to make all float or double expressions within the method body be explicitly FP-strict (§15.4). JLS 15.4 FP-strict expressions: 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

When should I use the “strictfp” keyword in java?

梦想与她 提交于 2019-12-17 01:36:42
问题 I've looked up what this does, but does anyone actually have an example of when you would use the strictfp keyword in Java? Has anyone actually found a use for this? Would there be any side-effects of just putting it on all my floating point operations? 回答1: Strictfp ensures that you get exactly the same results from your floating point calculations on every platform. If you don't use strictfp, the JVM implementation is free to use extra precision where available. From the JLS: Within an FP

strictfp in Java

我与影子孤独终老i 提交于 2019-12-06 21:24:25
问题 I'm implementing some neural network library in java , and there are intensive double (not Double ) matrix operations, Matrices are large and performance is required of course. So I came to read about strictfp keyword I honestly didn't understand what it does exactly and I was looking for simple explanation about If i should be using it or not and why 回答1: strictfp indicates that floating point calculations should use the exact IEEE754 standard. Without strictfp, the VM is free to use other

java关键字strictfp的用途

怎甘沉沦 提交于 2019-12-05 08:06:35
strictfp的意思是FP-strict,也就是说精确浮点的意思。在Java虚拟机进行浮点运算时,如果没有指定strictfp关键字时,Java的编译器以及运行环境在对浮点运算的表达式是采取一种近似于我行我素的行为来完成这些操作,以致于得到的结果往往无法令你满意。而一旦使用了strictfp来声明一个类、接口或者方法时,那么所声明的范围内Java的编译器以及运行环境会完全依照浮点规范IEEE-754来执行。因此如果你想让你的浮点运算更加精确,而且不会因为不同的硬件平台所执行的结果不一致的话,那就请用关键字strictfp。 可以将一个类、接口以及方法声明为strictfp,但是不允许对接口中的方法以及构造函数声明strictfp关键字 一旦使用了关键字strictfp来声明某个类、接口或者方法时,那么在这个关键字所声明的范围内所有浮点运算都是精确的,符合IEEE-754规范的。例如一个类被声明为strictfp,那么该类中所有的方法都是strictfp的。 来源: oschina 链接: https://my.oschina.net/u/102108/blog/85173

Does Java strictfp modifier have any effect on modern CPUs?

我怕爱的太早我们不能终老 提交于 2019-11-28 09:59:22
I know the meaning of the strictfp modifier on methods (and on classes), according to the JLS: JLS 8.4.3.5, strictfp methods: The effect of the strictfp modifier is to make all float or double expressions within the method body be explicitly FP-strict (§15.4). JLS 15.4 FP-strict expressions: 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

When should I use the “strictfp” keyword in java?

半世苍凉 提交于 2019-11-26 10:04:01
I've looked up what this does, but does anyone actually have an example of when you would use the strictfp keyword in Java? Has anyone actually found a use for this? Would there be any side-effects of just putting it on all my floating point operations? Strictfp ensures that you get exactly the same results from your floating point calculations on every platform. If you don't use strictfp, the JVM implementation is free to use extra precision where available. From the JLS : Within an FP-strict expression, all intermediate values must be elements of the float value set or the double value set,