title: C++ double division and return
body: <p>I understand that doubles are only approximations. But I was surprised that </p>
  
  <pre><code>double f(int x, int y)
  {
      return double(x)/y;
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>double f(int x, int y)
  {
      double z = double(x)/y;
      return z;
  }
  </code></pre>
  
  <p>can return different values. Does anyone know why?</p>