5000 - 4999.99 = 0.0100000000002
Can anyone think of a reason why I would be getting this stupid number?
The fields in the MySQL database are of type 'decimal(10,2)'.
The relevant code is this:
//$line is the variable used in the loop to store the rows
$fullactual = $line["AB_Actual"] + $line["AB_On_Order"];
$difference = $line["AB_Budget"] - $fullactual;
number_format($fullactual, 2);
number_format($difference, 2);
Firstly, what is wrong with this setup? It works fine for the vast majority of records, only a couple do this...
Secondly, is this the best way to handle working with currency/money in PHP/MySQL?
Thanks.