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.


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.




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

Reply via email to