title: Why can't we use '==' to compare two float or double numbers
body: <p>I am reading Effective java by Joshua Bloch and in <strong>Item 8: Obey the general contract when overriding equals</strong>, this statement is written</p>
  
  <blockquote>
    <p>for float fields, use the Float.compare method; and for double fields, use
    Double.compare. The special treatment of float and double fields is made
    necessary by the existence of Float.NaN, -0.0f and the analogous double
    constants;</p>
  </blockquote>
  
  <p>Can someone explain me with example why we can't use <code>==</code> for float or double comparison</p>