Possible Duplicate:
PHP Math Precision
Best practice for working with currency values in PHP?
I really hope someone can help. I've been hitting my head against a brick wall on this one.
Here's the situation: I have a checkout which calculates the subtotal after discount to be -£11.50. There is then £11.50 delivery cost to add which IMHO should equal £0.
However when the calculation is run it returns a float 2.8421709430404E-14
In my debug efforts I have done this:
var_dump(
$build['total'], // float(-11.5)
$build['delivery'], // float(11.5)
(($build['total'])+($build['delivery'])) // float(2.8421709430404E-14)
);
However when I do a static calculation:
var_dump((-11.5 + 11.5)); // float(0)
Any ideas?