簡體   English   中英

對 strictfp 和 StrictMath 的懷疑

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM