title: Java variable shows value of 'NaN' but var == Double.NaN is false, why?
body: <p>I have the code below:</p>
  
  <pre><code>sim = top / bottom;
  
  if(sim == Double.NaN) {
      System.out.println("sim is NaN");
  } else {
      System.out.println(sim);
  }
  </code></pre>
  
  <p>For some values in my program, <code>top / bottom</code> is <code>0.0 / 0.0</code> which should be equal to Double.NaN but when I stop at a breakpoint after this section the output shows 'NaN' -i.e. the value of <code>sim</code> rather than 'Sim is NaN'.</p>
  
  <p>Why does my test for <code>sim == Double.NaN</code> return false if I see it as 'NaN' in the debugger?</p>