title: The same arithmetic operations give different results in C++ and Python
body: <p>I had to find the result of a function <code>f(x) = x / (1-x)^2</code> , where <code>0 &lt; x &lt; 1</code>.
  The value had to be formatted up to <code>6</code> decimal places only. </p>
  
  <p>Here is my C++ code:  </p>
  
  <pre><code>float x; scanf("%f",&amp;x);
  printf("%.6f",x/((1-x)*(1-x)));
  </code></pre>
  
  <p>And I did for the same in Python:</p>
  
  <pre><code> x = float(input()) 
   print ("%.6f" % (x/((1-x)**2)))
  </code></pre>
  
  <p>For some values of x, both the programs give different answers.</p>
  
  <p>For example, for <code>x = 0.84567</code>,  </p>
  
  <p>C++ gives <code>35.505867</code> and Python gives <code>35.505874</code></p>
  
  <p>Why does this happen?<br>
  According to solution, the Python answers are right, while C++ answers are wrong.</p>