On Wed, 2002-04-17 at 13:01, Glenn Cannon wrote:
> I am dividing a number by 2.  How do I force a round up of the result?
>  
> Glenn.

There is undoubtedly a module for this, but here are some off the top of
my head solutions:

Unconditional round-up (ceiling):

$ceiling = int($num+.5) == int($num) ? int($num) : int($num+.5); 

Unconditional round down (floor):

$floor = int($num);

Rounding

$rounded = int($num+.5);

-- 
Today is Boomtime the 34th day of Discord in the YOLD 3168
Fnord.

Missile Address: 33:48:3.521N  84:23:34.786W


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to