[英]Doubt about strictfp and StrictMath
我有一個小技術問題,打電話是一樣的嗎:
public static strictfp double myMethod(double phi){
return Math.exp(phi);
}
或者:
public static double myMethod(double phi){
return StrictMath.exp(phi);
}
或者strictfp
關鍵字是否僅適用於方法內部使用的基本算術運算+ - * /
?
或者 strictfp 關鍵字是否僅適用於方法內部使用的基本算術運算 + - * /?
strictfp
關鍵字僅適用於它所修改的方法或 class 中的操作。 它不會將對Math
函數的調用重新路由到StrictMath
,因此您需要顯式使用StrictMath
而不是Math
。
來自http://www.esus.com/javaindex/j2se/jdk1.2/javamath/strictfp.html
如果浮點表達式在
strictfp
"范圍" 內,則結果將與 IEEE 754 中描述的一樣可預測...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.