title: What's wrong with using == to compare floats in Java?
body: <p>According to <a href="http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html" rel="noreferrer">this java.sun page</a> <code>==</code> is the equality comparison operator for floating point numbers in Java.</p>
  
  <p>However, when I type this code:</p>
  
  <pre><code>if(sectionID == currentSectionID)
  </code></pre>
  
  <p>into my editor and run static analysis, I get: "JAVA0078 Floating point values compared with =="</p>
  
  <p>What is wrong with using <code>==</code> to compare floating point values?  What is the correct way to do it?&nbsp;</p>