title: Is this a floating point error? Multiplication producing wrong result
body: <p>I keep getting the wrong result for multiplication, it only compounds with more iterations, but at one it returns 500 instead of 495.</p>
  
  <p>I have tried initializing the variable and flipping the terms but it is not helping.</p>
  
  <pre><code>void output_short_format(double loan_amount, double interest_rate, double term_years){
      double payment,interest=0,total,months,temp;    
  
      temp = loan_amount;
      interest_rate /= 12;
      months = 12 * term_years;
      payment = loan_amount * interest_rate * (pow(1+interest_rate,months)/(pow(1+interest_rate,months)-1));
  
      for(int i=1;i&lt;=months;i++){
      interest += temp*interest_rate;
      temp -= payment;
      }
  </code></pre>
  
  <p>I expect 150000 * 0.0033 to produce 495 not 500</p>