Why does
<?php echo 194.95-194.94; ?>
output
0.0099999999999909
What am i missing here? This is php 5.2.
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.
The issue is that you cannot represent 0.01 exactly in floating point.
Have a look at what every programmer should know about floating point for a great explanation of why this is, and what to do about it.