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="e7bfd5885b4d005a-8911ac55-422c44db-88c684ad-4155dc550af1c4aba9d94980"><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="e02fd38908e37cab-f96379c5-4b624e9b-a6608dbf-0393c7906e1c37da35870e4c"><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="2ed32bc05b0ce53b-3152b4ce-4f7841cd-abf581f5-fe2546c0c67576dd3634ce23"><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="6635c92252b44c20-a9c90340-44704601-963c97fc-8bb3f8a7b1659f98c69bf0ce"><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="4004b38381381d36-d5e32bcf-474742bf-becd9064-d715c03b385828a51dd4afa1"><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="80fec4a341d96a7d-d4809ebc-462745cc-8bb1bb61-6daf17188a505c2b0c733a2e"><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>

...