Weird calculation in PHP
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/588004/is-javascripts-math-broken">Is JavaScript&#39;s Math broken?</a><br>
  <a href="http://stackoverflow.com/questions/8725708/adding-fractions-number-yields-different-result-in-php">Adding fractions number yields different result in PHP</a>  </p>
</blockquote>



<pre><code>$grand_total =  (float)$subtotal_email +  (float)$delivery_email + (float)$fuel_surcharge_email - (float)$discount_coupon_email + (float)$texas_tax_email - (float)$cancel_fee_email -  (float)$refund_email - (float)$refund_tax_email - (float)$coupon_tmp;
echo (float)$subtotal_email." +  ".(float)$delivery_email." + ".(float)$fuel_surcharge_email." - ".(float)$discount_coupon_email." + ".(float)$texas_tax_email." - ".(float)$cancel_fee_email." -  ".(float)$refund_email." - ".(float)$refund_tax_email." - ".(float)$coupon_tmp." = ".(float)$grand_total;
</code></pre>

<p>When I run the above in php, I get the following output:</p>

<pre><code>89.99 + 0 + 16.2 - 0 + 8.61 - 3 - 100 - 10 - 1.8 = -2.88657986403E-15
</code></pre>

<p>But if you look at LHS, it should be <code>0</code>, and this happens with or without float....any idea why?</p>
