title: What is result of comparison of double and NaN?
body: <p>I have the following program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  
  int main() {
      double a = 1;
      double b = nan("");
  
      std::cout &lt;&lt; (a &gt; b) &lt;&lt; std::endl;
      std::cout &lt;&lt; (b &gt; a) &lt;&lt; std::endl;
  
      return 0;
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>0
  0
  </code></pre>
  
  <p>In general from the meaning of <code>nan</code> - <code>not a number</code> it is clear that any operation with <code>nan</code> is essentially pointless. From <code>IEEE-754</code> that I found in internet I found what if in FPU at least one of operands is <code>nan</code> the result is also <code>nan</code>, but I found nothing about comparison between normal value and <code>nan</code> as in example above.</p>
  
  <p>What does standard say about it?</p>