Chapter: Java The Complete Reference - The Java Language - I/O, Applets, and Other Topics

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail

strictfp - Java

With the creation of Java 2, the floating-point computation model was relaxed slightly.

strictfp

 

With the creation of Java 2, the floating-point computation model was relaxed slightly. Specifically, the new model does not require the truncation of certain intermediate values that occur during a computation. This prevents overflow or underflow in some cases. By modifying a class, a method, or interface with strictfp, you ensure that floating-point calculations (and thus all truncations) take place precisely as they did in earlier versions of Java. When a class is modified by strictfp, all the methods in the class are also modified by strictfp automatically.

 

For example, the following fragment tells Java to use the original floating-point model for calculations in all methods defined within MyClass:

 

strictfp class MyClass { //...

Frankly, most programmers never need to use strictfp, because it affects only a very small class of problems.


Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail


Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.