title: Double comparison in C
body: <p>A checker(of type double) array is obtained from a gsl_vector in the following way.</p>
  
  <pre><code>for (i=0; i&lt;M; i++)
  {               
      checker[i] = (double)gsl_vector_get(check, i);
      printf(" %f", checker[i]);
  }
  </code></pre>
  
  <p>Array checker has <code>[ 3.000000 -3.000000 -11.000000 -5.000000 ]</code> elements after the above operation (from the output of the above program).</p>
  
  <p>I am facing a weird problem now. </p>
  
  <pre><code>for (i=0; i&lt;M; i++)
  {
      printf("checker: %f\n", checker[i]);        
      if(checker[0] == 3.00)
      {           
          printf("Inside If: %f\n", checker[i]);          
      }
  }
  </code></pre>
  
  <p>The above code outputs </p>
  
  <pre><code>checker: 3.000000
  checker: -3.000000
  checker: -11.000000
  checker: -5.000000
  </code></pre>
  
  <p>As seen, the <code>if</code> loop inside <code>for</code> is not executed. What could be the problem? </p>
  
  <p><strong>Edit</strong>: The above problem is gone when I directly copied <code>[ 3.000000 -3.000000 -11.000000 -5.000000 ]</code> into the checker Array instead of the <code>gsl_vector_get(check,i)</code>. Check value comes from <code>dgmev</code> function where a matrix and a vector are multiplied.</p>
  
  <p>Thanks</p>