Re: Round with money_format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sep 17, 2011, at 10:56 AM, Bill Guion wrote:
> On Sep 17, 2011, at 3:46 AM, Cyril Lopez wrote:
>> 
>> Can someone help me understand how money_format() rounds numbers ?
>> 
> As someone else pointed out, rounding rules vary by locale, but I was taught 40+ years ago in graduate school programming class, 4 rounds down, 6 rounds up, and 5 rounds to the even number. This means 65 rounds to 6, while 75 rounds to 8. Your example seems to follow that rule.

Bill:

For many years (40+) I've claimed the same solution. I even wrote a routine to prove that algorithm is better than the one used in round().

The only problem is that it requires millions of instances to show any significant difference. IOW, it's simply not worth the effort.

Cheers,

tedd


_____________________
tedd@xxxxxxxxxxxx
http://sperling.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux