...
NaN
values are particularly problematic because they are unordered. That is, the expression NaN == NaN
always returns false
. (See rule "NUM10NUM07-J. Do not attempt comparisons with NaN.")
Noncompliant Code Example
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="1fea286c68d5ea58-11b63e21-4cac47a3-8b01897d-1a9cfca91cf5db2aad5ff578"><ac:plain-text-body><![CDATA[ | [[IEEE 754 | https://www.securecoding.cert.org/confluence/display/seccode/AA.+C+References#AA.CReferences-IEEE7542006 | IEEE 754]] | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="50ee3b1e90260557-ea6149ed-460844f9-a82c9f1b-5568f2fd8daf4c8f9468fbf0"><ac:plain-text-body><![CDATA[ | [[IEEE 1003.1, 2004 | https://www.securecoding.cert.org/confluence/display/seccode/AA.+C+References#AA.CReferences-IEEE1003 | IEEE 1003.1, 2004]] | ]]></ac:plain-text-body></ac:structured-macro> |
...
NUM10-J. Do not attempt comparisons with NaN 03. Numeric Types and Operations (NUM) NUM12-J. Do not use floating-point variables as loop counters