...
Using the strictfp
modifier leaves execution unchanged on platforms that lack platform-specific floating-point behavior. It can have substantial impact, however, on both the efficiency and the result values of floating-point computations when executing on platforms that implement platform-specific floating-point behavior. On these platforms, using the strictfp
modifier increases the likelihood that intermediate operations will overflow or underflow because it restricts the range that can be represented and the precision of intermediate values; it can also reduce computational efficiency. These issues are unavoidable when portability is the main concern.
...
An expression is strict when any of the containing classes, methods, or interfaces is declared to be strictfp
. Constant expressions containing floating-point operations are also evaluated strictly. All compile-time constant expressions are by default, strictfp
.
...
This compliant solution uses the strictfp
keyword to require exact conformance with standard Java floating-point. Consequently, the intermediate value of both computations of f * g
will be identical to the value stored in this.d
, even on platforms that support extended range exponents.
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="49ad70c98766375a-44538fe3-459e4e32-bc77b0b7-9be6b52f70ee9d8b06331f28"><ac:plain-text-body><![CDATA[ | [[Darwin 2004 | AA. Bibliography#Darwin 04]] | Ensuring the Accuracy of Floating-Point Numbers | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="fc44826ee63c23f1-1231cca3-46dd42b2-83bdb253-2c8509bd8fc25ef36f4211a4"><ac:plain-text-body><![CDATA[ | [[JLS 2005 | AA. Bibliography#JLS 05]] | [§15.4, "FP-strict Expressions" | http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.4] | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="be960ada3c4ec016-132c13ff-42904cea-b6228061-550130b678986dfc92dde7dd"><ac:plain-text-body><![CDATA[ | [[JPL 2006 | AA. Bibliography#JPL 06]] | 9.1.3. Strict and Non-Strict Floating-Point Arithmetic | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f5b680709f44793f-011c90ad-4ffd42b1-83fc8d61-b6682f735efb48b120cec3d9"><ac:plain-text-body><![CDATA[ | [[McCluskey 2001 | AA. Bibliography#McCluskey 01]] | Making Deep Copies of Objects, Using strictfp, and Optimizing String Performance | ]]></ac:plain-text-body></ac:structured-macro> |
...