...
NaN
values are particularly problematic because they are unordered. That is, the expression NaN == NaN
always returns false
(see guideline NUM05NUM10-J. Do not attempt comparisons with NaN). In general, any comparisons with NaN
return false
, and all arithmetic functions with one or more NaN
inputs produce NaN
as their output. Consequently, a single occurrence of a NaN
value can cause regressions within other code segments. This correctâ”and arguably desirableâ”behavior can cause unexpected results.
...
Wiki Markup |
---|
\[[IEEE 754|https://www.securecoding.cert.org/confluence/display/seccode/AA.+C+References#AA.CReferences-IEEE7542006|IEEE 754]\] \[[IEEE 1003.1, 2004|https://www.securecoding.cert.org/confluence/display/seccode/AA.+C+References#AA.CReferences-IEEE1003|IEEE 1003.1, 2004]\] |
...
NUM05NUM10-J. Do not attempt comparisons with NaN 03. Floating Point (FLP) NUM07-J. Do not use floating point variables as loop counters