Possible Duplicate:
php calculate float
The accuracy of PHP float calculate
Why does PHP calculate -2.27373675443E-13 for this…
echo (89.99*12) - 1079.88;
shouldn’t it return 0?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
floating point calculations are complicated and potentially inaccurate. this problem appears in every programming-language because decimal numbers can’t be stored perfectly in binary representation.
to quote PHPs documentation about this: