Java strictfp关键字
保证浮点运算的结果不受平台的影响,在任何平台上,使用统一的标准进行浮点运算,提高程序的可移植性(毕竟结果更可控,更精确),相应的,以降低性能为代价
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.
In other words, it's about making sure that Write-Once-Run-Anywhere actually meansWrite-Once-Get-Equally-Wrong-Results-Everywhere.(幽默啊)
With strictfp your results are portable, without it they are more likely to be accurate.
转自:http://stackoverflow.com/questions/517915/when-should-i-use-the-strictfp-keyword-in-java