Php calculation gives wrong value

I am using the following code

$a = -158004.69;
$b = 166669.86000000;
$c = 8665.17000000;
$calc = $a+($b-$c);

Using Calculator I am getting the value as Zero. But using code, I am getting someother value.
I have tried (float) and floatval(). But no difference.

and what’s the expected value? if you need precise floating point arithmetic use the BC extension

Sponsor our Newsletter | Privacy Policy | Terms of Service