title: Sum of array of floats returns different results
body: <p>Here I have a function <code>sum()</code> of type <code>float</code> that takes in a pointer <code>t</code> of type <code>float</code> and an integer <code>size</code>. It returns the sum of all the elements in the array. Then I create two arrays using that function. One that has the BIG value at the first index and one that has it at the last index. When I return the sums of each of those arrays I get different results. <br><strong>This is my code:</strong></p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  
  #define N     1024
  #define SMALL 1.0
  #define BIG   100000000.0
  
  float sum(float* t, int size) {        // here I define the function sum()
    float s = 0.0;
    for (int i = 0; i &lt; size; i++) {
      s += t[i];
    }
    return s;
  }
  
  int main() {
    float tab[N];
    for (int i = 0; i &lt; N; i++) {
      tab[i] = SMALL;
    }
  
    tab[0] = BIG;
    float sum1 = sum(tab, N);            // initialize sum1 with the big value at index 0
    printf("sum1 = %f\n", sum1);
  
    tab[0] = SMALL;
    tab[N-1] = BIG;
    float sum2 = sum(tab, N);            // initialize sum2 with the big value at last index
    printf("sum2 = %f\n", sum2);
  
    return 0;
  }
  </code></pre>
  
  <p><strong>After compiling the code and running it I get the following output:</strong></p>
  
  <pre><code>Sum = 100000000.000000
  Sum = 100001024.000000
  </code></pre>
  
  <p><strong>Why</strong> do I get different results even though the arrays have the same elements ( but at different indexes ).</p>