title: How to produce a NaN float in c?
body: <pre><code>float f = (float)'a';
  if(f &lt; 0){ 
  }   
  else if(f == 0){ 
  }   
  else if(f &gt; 0){ 
  }   
  else{
      printf("NaN\n");                                                          
  }   
  </code></pre>
  
  <p><code>f</code> won't be greater/equal/less than <code>0</code> if it's a <code>NaN</code>.</p>
  
  <p>But how to produce such a <code>f</code> in the first place?</p>
  
  <p>I tried various ways to produce a <code>NaN</code>,but none work..</p>