Opentopia Directory Encyclopedia Tools

Strictfp

Encyclopedia : S : ST : STR : Strictfp


The correct title of this } is }}}. The initial letter is capitalized due to [Naming conventions #Lower case first lettertechnical restrictions].
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 can be used 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 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 

References

 


From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.

Search Titles
0123456789
ABCDEFGHIJ
KLMNOPQRST
UVWXYZ?

E-mail this article to:

Personal Message: