title: floating-point constant comparison - (0.0 ? 1 : 0)
body: <p>In the example below, if uncomment <code>float f = 0.0;</code>,<br>
   and replacing the <code>return(0.0 ? 1 : 0);</code> with <code>return(f ? 1 : 0);</code>.<br>
  The output is <code>NIL</code>.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>/* file main.c 
  Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
  cl -W4 -MTd -O2 -TC main.c -Fetest */   
  #include &lt;stdio.h&gt;    
  int my_func(void)
  {
     /* float f = 0.0; */
     return(0.0 ? 1 : 0);
  }
  int main(void)
  {  
      printf("%s\n", ( my_func() ? "ONE" : "NIL") );
      return 0;
  }
  </code></pre>
  
  <p>On a 32-bit Windows machine, using Visual Studio this code outputs  :  </p>
  
  <pre><code>ONE
  </code></pre>
  
  <ul>
  <li>Why <code>my_func()</code> returns value <code>true</code> (1)  ?</li>
  <li>How does the C compiler interpret this expression <code>(0.0 ? 1 : 0)</code> ?</li>
  </ul>