Page 1 of 1

Re: PHP returns incorrect total

Posted: Wed Nov 07, 2012 10:51 pm
by MeroD
Floating-point data types like DOUBLE are approximate and do not represent exact numbers.

number_format($...total) may give you better results.

Re: PHP returns incorrect total

Posted: Thu Nov 08, 2012 8:23 am
by johnj
It is better to use the bcmath function for math calculations.
http://php.net/manual/en/book.bc.php