title: How do I use accurate float arithmetic in Python?
body: <p>I'm having this issue in python with float arithmetic.
  The equation I'm solving goes as follows:</p>
  
  <pre><code>-a *((x-m)*110.0*(1-m))**b +a*((x-m)*110.0*(1-m))**c
  a is a really large positive number (in the hundred thousands)
  b is 1.0000002
  c is 0.9999998
  </code></pre>
  
  <p>When I do this in excel I get accurate results but when I do it in python I get completely inaccurate results. </p>
  
  <p>The results are exactly the same for each separate part until I multiply by -a and a.
  So ((x-m)<em>110.0</em>(1-m))**b and ((x-m)<em>110.0</em>(1-m))**c are exactly the same as their excel calculated values but when they're multiplied by the large number they completely change.</p>
  
  <p>How do I do this? do I have to use a different language? Is this problem only in python or is it in all languages?</p>
  
  <p>Edit: It is the exact same equation in excel as in python. Exactly the same. The numbers are also the same until I multiply by a and -a. then they are both off by 5 point something. The answer in excel is around 0.47 for x=0.5 and m = 0.265 while the answer for python is around -0.67</p>