Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: REM cost reform

...

Comparisons with NaN values can lead to unexpected results.

Rule

Severity

Likelihood

Remediation Cost

Detectable

Repairable

Priority

Level

NUM07-J

Low

Probable

Yes

Medium

Yes

P4

P6

L3

L2

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
CodeSonarPMD.Design.BadComparison
FB.CORRECTNESS.FE_TEST_IF_EQUAL_TO_NOT_A_NUMBER
Bad comparison
Doomed test for equality to NaNParasoft Jtest9.5PB.NUM.NANImplemented
Klocwork

Include Page
Klocwork_V
Klocwork_V

JAVA.COMPARE.NAN
Parasoft Jtest
Include Page
Parasoft_V
Parasoft_V
CERT.NUM07.NANAvoid comparisons to Double.NaN or Float.NaN
PVS-Studio

Include Page
PVS-Studio_V
PVS-Studio_V

V6038

Bibliography

...


...

Image Modified