开发者

Doubt about strictfp and StrictMath

I have a little technical question, is it the same to call:

   public static strictfp double myMethod(double phi){
       return Math.exp(phi);
   }

or:

   public static double myMethod(double phi){
       return StrictMath.exp(phi);
   }

Or does the 开发者_StackOverflowstrictfp keyword just applies to the basic arithmetic operations + - * / used inside the method?


Or does the strictfp keyword just applies to the basic arithmetic operations + - * / used inside the method?

The strictfp keyword only applies to operations in the method or class it modifies. It doesn't reroute calls to Math functions to StrictMath, so you need to explicitly use StrictMath instead of Math.

From http://www.esus.com/javaindex/j2se/jdk1.2/javamath/strictfp.html

If a floating point expression is within a strictfp "scope", the results will be as predictable as described in IEEE 754 ...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜