title: C float operations have different results on i386 and arm, but why?
body: <p>I have an implementation of an algorithm in C which uses floats.
  When I compile and run on i386 I get different results to the results I get when I compile and run on armel.  In particular division-of-int-by-float, results in a different float.</p>
  
  <p>I've extracted some code from my algorithm to demonstrate this problem:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  void main(void)
  {
      float x = 4.80000019;
      float y = 4.80000019;
      int a = 38000;
      int b = 10000;
      int result = (a/x)+(b/y);
      printf("%.8f, %.8f\n", x, y); // same on i386 and armel
      printf("%f, %f\n", a/x, b/y); // slightly different on each
      printf("%d\n", result);       // prints 9999 on i386, and 10000 on armel
  }
  </code></pre>
  
  <p>Can anybody explain why the two platforms generate different results?</p>
  
  <p>Alex</p>