Is there a way to tell the Java VM to enforce the strictfp
behavior across all float point operations regardless of whether the code used the strictfp
modifier or not?
I have looked for -X option that would do the trick in Oracle's SE Jdk (I restricted to only use 1.8) but there is such an option.
Is there perhaps a VM for MacOS that in compliant with 1.8 and that only implements strictfp behavior regardless of hardware present?
I researched this a long time ago for a different Q&A. What I found was:
If you could change to using the Oracle JRockit JVM, it has a JVM option to enable strictfp
semantics globally: -XstrictFP
According to the 2nd reference, there is a -XX:-UseStrictFP
option on some Hotspot JVMs. However:
strictfp
semantics.strictfp
.I was able to confirm the first two points by looking at the OpenJDK Java 8 source code1.
In summary, there is probably nothing that will help you in a regular Hotspot JVM.
References:
1 - While looking, I noticed that the JIT compiler for intel platforms does appear to pay some attention to strictfp
. So @rzwitserloot's comment about strictfp
being irrelevant on modern hardware might not be correct. However, I don't have the knowledge or patience to research this properly.