Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Wiki MarkupAccording to the JLS, [§4.2.3, "Floating-Point Types, Formats, and Values"|http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3] \[ [JLS 2005|AA. References#JLS 05]\]:

NaN (not-a-number) is unordered, so the numerical comparison operators <, <=, >, and >= return false if either or both operands are NaN. The equality operator == returns false if either operand is NaN, and the inequality operator != returns true if either operand is NaN.

...

Automated detection of comparison with NaN is straightforward. Sound determination of whether the possibility of an unordered result has been correctly handled is not feasible in the general case. Heuristic checks could be useful.

Bibliography

...

[[FindBugs 2008AA. References#FindBugs 08]]

FE: Doomed test for equality to NaN

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="08c62919-e62e-4daa-be2b-6bf774cb0a91"><ac:plain-text-body><![CDATA[

[ [JLS 2005AA. References#JLS 05]]

[§4.2.3, Floating-Point Types, Formats, and Values

http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3]

]]></ac:plain-text-body></ac:structured-macro>

...

NUM06-J. Use the strictfp modifier for floating-point calculation consistency across platforms      03. Numeric Types and Operations (NUM)