Re: Problem with calculation....
| From: | Scott S. Nicholson | Date: | Tue, 23 May 2000 13:18:20 +0000 |
| Subject: | Re: Problem with calculation.... | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-351@lists.php.net to get a copy of this message | ||
> It occurs to me that perhaps the number_format() is messing it up?
> Would the commas that that function inserts mess up calculations?
> I also just realized that the problem manifests itself when 'balance'
> gets below $10,000. I'll have to try it with something other than
> number_format()...
No good. I tried changing the number_format() to num_format, using a custom
function:
function num_format($number) {
$number *= 100;
$number = round($number);
$number /= 100;
return($number);
}
Which should return the number rounded to two decimals, but the problem
still exists. (BTW, is there a built-in function that'll round to 'n'
decimals without adding the thousands seperators that number_format() does?)
Any ideas?
Scott Nicholson
scottn@pnx1.com