Why does
<?php echo 194.95-194.94; ?>
output
0.0099999999999909
What am i missing here? This is php 5.2.
Why does
<?php echo 194.95-194.94; ?>
output
0.0099999999999909
What am i missing here? This is php 5.2.
收起
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.
报告相同问题?