Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Automated detection of floating-point arithmetic is straight-forward; determining which code suffers from insufficient precision is not feasible in the general case. Heuristic checks, such as flagging floating-point literals that cannot be represented precisely, could be useful.

Related Guidelines

The CERT C Secure Coding Standard

"FLP02-C. Avoid using floating point numbers when precise computation is needed"

The CERT C++ Secure Coding Standard

"FLP02-CPP. Avoid using floating point numbers when precise computation is needed"

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="2bbc66474496ca82-9faf180d-46f740f9-98c99e8c-eb79fcb1569ddd2bb065a127"><ac:plain-text-body><![CDATA[

[ISO/IEC TR 24772:2010

http://www.aitcnet.org/isai/]

"Floating?point Arithmetic [PLF]"

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

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="23561b607818cea5-a10b42c2-47ec402b-a7c58ce5-4b6aa27a03ddf42d14c9852f"><ac:plain-text-body><![CDATA[

[[Bloch 2008

AA. Bibliography#Bloch 08]]

Item 48: Avoid float and double if exact answers are required

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="fbef48932f5aee0b-d9b4c1c5-4d1a4ce9-9a1a982d-ad8f3c1435714c9d33c4c167"><ac:plain-text-body><![CDATA[

[[Bloch 2005

AA. Bibliography#Bloch 05]]

Puzzle 2: Time for a Change

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="840a2a4b26da8043-650aae34-4fae4de0-84808662-4579608ce4f8947f3c26812d"><ac:plain-text-body><![CDATA[

[[Goldberg 1991

AA. Bibliography#Goldberg 91]]

 

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c9f1c6f5a6350b21-ece9cc38-4f064869-bbc39a08-0bc6339e8ab7d188def77ca9"><ac:plain-text-body><![CDATA[

[[IEEE 754

AA. Bibliography#IEEE 754 2006]]

 

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="dfb2c9a0e891c568-e48523a2-4c9f4e93-836e8402-cec38795e7bcb013676c3a2f"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#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>

...