Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Parasoft Jtest 2020.2

...

Comparisons with NaN values can lead to unexpected results.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

NUM07-J

Low

Probable

Medium

P4

L3

Automated Detection

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.

ToolVersionCheckerDescription
CodeSonar
 

PMD.Design.BadComparison

FB.CORRECTNESS.FE_TEST_IF_EQUAL_TO_NOT_A_NUMBER

Bad comparison

Doomed test for equality to NaN

Parasoft Jtest
Include Page
java:
Parasoft_V
java:
Parasoft_V
PB.NUM.NAN
Implemented
Avoid comparisons to Double.NaN or Float.NaN

Bibliography

...


...