I have a database that stores a value of the type double. I do a SUM() query on the column and return save the value to a variable called, '$amount' which I divide into a fixed value (5000) . The math works out fine when $amount < 1000. However, when $amount > 1000, then the decimal places are wrong.
// successful query, now fetch the data. $row = mysql_fetch_row($result); if (!$row) { return (-1); } $dollar = $row[0]; $tmp = ($dollar)/((double)5000); echo $tmp; return ($dollar); $amount = 1,104.40 the result of echo, $tmp is displayed as '0.0002'. What's wrong here? The problem only occurs when the value is greater than a 1,000? Could the ',' messed the computation up somehow? I did another computation $a = 1000 $b = 5000 $c = $a/$b; Thanks, -Peter $c does equal '0.2' which is correct. $amount -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php