Fernando <[EMAIL PROTECTED]> said something to this effect on 08/08/2001:
> If there in perl any function that round a number for example:
> 
> 13.96 to 14.00 or 14
> 
> I don't want to use any module, just a simple function. Thanks for the help
> I alwys receive.

The easiest way is to add 0.5, and then take the integer value:

$ perl -le '
for my $n (13.96, 13.06, 13.5) {
    my $rounded_n = int $n + 0.5;
    print $rounded_n;
}'

14
13
14

(darren)

-- 
The optimist proclaims we live in the best of all possible worlds, and
the pessimist fears this is true.
    -- James Branch Cabell

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

Reply via email to