0

I use some double math operations without strictfp in my code.

I run docker on different OS but everywhere I use the same dockerFile.

Is it posssible to get different results in my math operations?

P.S.

I know that Strictfp ensures that you get exactly the same results from your floating point calculations on every platform. But I am not fully sure what does it mean 'platform'

gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
  • have you tried on different OS e.g linux and windows so you can compare the results ? – Mostafa Hussein Mar 18 '19 at 15:41
  • I have only one OS now but I curious to know what happens on another OS – gstackoverflow Mar 18 '19 at 15:43
  • Java is a JIT-compile language, so the final machine code is generated on each target platform. Easy to imaging that you'd get different results on platforms with/without FMA if the (JIT) compiler is allowed to contract `x*y+z` into `fma(z, x,y)`. e.g. x86 Sandybridge vs. Haswell, or in a VM that doesn't expose AVX/FMA. If you had a docker image with ahead-of-time compiled binaries that don't do any runtime dispatching based on instruction availability, *that* would be deterministic. Especially if we rule out 32-bit x86 where instructions like `fsin` might not give identical results everywhere – Peter Cordes Mar 18 '19 at 15:52

0 Answers0