Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: fixed formatting oopsie

The Java language allows platforms to use available floating point hardware that can provide floating point support with exponents that contain more bits than the standard Java primitive type double (in the absence of the strictfp modifier). Consequently, these platforms can represent a superset of the values that can be represented by the standard floating point types. Floating point computations on such platforms can produce different results than would be obtained if the floating point computations were restricted to the standard representations of float and double. According to the JLS, Section 15.4, "FP-Strict Expressions"

Wiki Markup
the net effect \[of non-fp-strict evaluation\], roughly speaking, is that a calculation might produce "the correct answer" in situations where exclusive use of the float value set or double value set might result in overflow or underflow.

Programs that require consistent results from floating point operations across different JVMs and platforms must use the strictfp modifier. This modifier requires the JVM and platform to behave as though all floating point computations were performed using values limited to those representable by a standard Java float or double, consequently guaranteeing that the result of the computations will match exactly across all JVMs and platforms.

...