From Seo Wiki - Search Engine Optimization and Programming Languages

Jump to: navigation, search

strictfp is a Java keyword used to restrict floating-point calculations to ensure portability. The modifier was introduced into the Java programming language with the Java virtual machine version 1.2.

In older JVMs, floating-point calculations were always strict floating-point, meaning all values used during floating-point calculations are made in the IEEE-standard float or double sizes. This could sometimes result in a numeric overflow or underflow in the middle of a calculation, even if the end result would be a valid number. Since version 1.2 of the JVM, floating-point calculations do not require that all numbers used in computations are themselves limited to the standard float or double precision.

However, for some applications, a programmer might require every platform to have precisely the same floating-point behavior, even if some platforms could handle more precision. In that case, the programmer can use the modifier strictfp to ensure that calculations are performed as in the earlier versions—only with floats and doubles.

The modifier can be used in combination with classes, interfaces and non-abstract methods.

Compile-time constant expressions must always use strict floating-point behavior. Other expressions use strict floating-point math if they are contained in a method, interface, or class which uses the strictfp modifier in its declaration. In a class declaration, the modifier can be placed like this:

public strictfp class MyFPclass { 
    // ... contents of class here ...


 // From java.lang.Math class............
 public static strictfp double abs(double);
 public static strictfp int max(int, int);
 public static strictfp long max(long, long);
 public static strictfp float max(float, float);
 public static strictfp double max(double, double);
 public static strictfp int min(int, int);


Personal tools

Served in 0.115 secs.