Joel R Stout wrote:
> print "   rand: $p \n";
> print "    int: $q \n";
> print "   ceil: $r \n";
> print "  floor: $s \n";
> 
> if ( $p - $s >= .5 ){
>     $t = $r
> } else {
>     $t = $s
> }
> print "rounded: $t\n";

Another novice's 2 [euro] cents:

$round = ($number>0)?floor($number+.5):ceil($number-.5);

Results of this are:
$number -5.6 -5.5 -5.4 -5.0 +0.0 +0.4 +0.6 +1.0 +1.1 +1.5 +1.7
$round  -6.0 -6.0 -5.0 -5.0 -0.0 +0.0 +1.0 +1.0 +1.0 +2.0 +2.0

Regards,
-- 
Juanra || http://html.conclase.net/


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

Reply via email to