java-card.png

I just learned there are some (not very known) modifiers in the Java language, one in particular is called strictfp.

Natively, java uses the IEE754 for the float and double values , but it can extend the the exponent range where available resulting in more precise results.

But, when we use the keyword strictfp in a class or a method, we are forcing the results of floating-point calculations to be IEEE754, ensuring an identical result on every platform.

This keyword can be used on classes or methods just like the next code shows:

public strictfp class SomeClass {

    ... 
}

 

public  class SomeClass {

    public strictfp Double someMethod(){
      ...  
    }
}

 

Depending where is used it will be the scope of the IEEE754 FP calculations and using the strictfp you may not be able to use some JAVA capabilities for floating point.