title: Confusion on NaN in Java
body: <pre><code>int i = 0, j = 0;
  double nan1 = (double)0/0;
  double nan2 = (double)0/0;
  double nan3 = (double)i/j;
  System.out.println(Double.doubleToRawLongBits(nan1) == Double.doubleToRawLongBits(nan2));
  System.out.println(Double.doubleToRawLongBits(nan1) == Double.doubleToRawLongBits((double)0/0));
  System.out.println(Double.doubleToRawLongBits(nan3) == Double.doubleToRawLongBits(nan2));
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>true
  true
  false
  </code></pre>
  
  <p>Please help me how the output came <code>true</code> for first two and <code>false</code> for last one. Please tell me what is actual work of <strong>Double.doubleToRawLongBits()</strong> method.</p>