What would be the most "good practice" way of dealing with php's wrong calculations of decimal numbers ? Please look at example below:
$avg = 311.345;
$delta = 88.645;
$value = 222.7;
if ($value == $avg-$delta) { // $avg - $delta is EXACTLY 222.7
echo 'TRUE';
} else {
echo 'FALSE';
}
This is supposed to echo TRUE while it echoes out FALSE.
Now .. i do understand if i use a workaround such as
if ($value == round($avg-$delta, 2))
the problem will go away
However, using workarounds is one thing i hate, so my question is .. is there a good and absolutely correct way to handle this ? something like adjusting some values in php.ini or adding installing some extension(s) for PHP , or something amongst those lines ?