I am getting wrong result while adding float numbers, pls tell me how you programmer are escaping from this
Code:
$tot = 0;
$ans = (float)101;
for($i=1; $i<= 10; $i++){
$tot = $tot + 10.1;
}
var_dump($tot);
var_dump($ans);
if($tot == $ans){
echo '<br />Both are equal ';
}
else{
echo '<br />Both are not equal ';
}
Result:
float 101
float 101
Both are not equal