Mega Code Archive

 
Categories / Php / Data Type
 

Addition of two floating-point variables compared to a variable with the expected value result can lead to an unexpected result.

<?php $a=50.3; $b=50.4; $c=100.7; if ($a + $b == $c) {   echo "$a + $b == $c\n"; } else {   echo "$a + $b != $c\n"; } ?>