On Sep 28, 2012, at 9:27 AM, Jim Giner <jim.gi...@albanyhandball.com> wrote:

> On 9/28/2012 2:11 AM, Simon J Welsh wrote:
>> On 28/09/2012, at 6:08 PM, Chris Payne <oxygene...@gmail.com> wrote:
>> 
>> I would use something similar to $rounded_number = ceil($test2/1000)*1000;
>> ---
>> Simon Welsh
>> Admin of http://simon.geek.nz/
>> 
> From my days as a math major, rounding doesn't always go up - it goes to the 
> nearest level that you have indicated.  As Simon shows you, you want to ceil 
> to always go up, and floor to always go down.  Neat function names 
> actually... :)

A more accurate rounding is HALF-EVEN -- first Google search produces:

http://www.crazysquirrel.com/computing/java/basics/rounding.jspx

I did this with php several years ago, namely:

http://www.webbytedd.com/bbb/rounding/

I leave it to the community to develop the code.

Cheers,

tedd

_____________________
t...@sperling.com
http://sperling.com


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

Reply via email to