title: Negative NaN is not a NaN?
body: <p>While writing some test cases, and some of the tests check for the result of a NaN.</p>
  
  <p>I tried using <code>std::isnan</code> but the assert failes:</p>
  
  <pre><code>Assertion `std::isnan(x)' failed.
  </code></pre>
  
  <p>After printing the value of <code>x</code>, it turned out it's negative NaN (<code>-nan</code>) which is totally acceptable in my case.</p>
  
  <p>After trying to use the fact that <code>NaN != NaN</code> and using <code>assert(x == x)</code>, the compiler does me a 'favor' and optimises the assert away.</p>
  
  <p>Making my own <code>isNaN</code> function is being optimised away as well.</p>
  
  <p>How can I check for both equality of NaN <em>and</em> -NaN?</p>