Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This noncompliant code example compares the string representations of two floating-point values.:

Code Block
bgColor#FFCCCC
int i = 1;
String s = Double.valueOf(i / 1000.0).toString();
if (s.equals("0.001")) {
  // ...
}

The comparison unexpectedly fails because s contains the string "0.0010001".

Noncompliant Code Example (Regex)

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

NUM11-J

lowLow

likelyLikely

mediumMedium

P6

L2

Related Vulnerabilities

...

 

...