Have written a simple PHP program to get data from a database to an accounting program. Therefore I need to do some calculations. And one of them goes completely wrong.
<?php
$prijs = 480.00;
$nvh = 432.00;
$prov = 40.34;
$btw = 7.66;
$over = $prijs - ($nvh + $prov + $btw);
$tmp = ($nvh + $prov + $btw);
echo $prijs."\n";
echo $tmp."\n";
echo $prijs - $tmp."\n";
echo $over."\n";
?>
The result should be $over == 0 and $prijs - $tmp should also be 0.
But I get the following output:
480
480
-5.6843418860808E-14
-5.6843418860808E-14
Anybody? What is going on here?