Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Answer: How do I round up a number?

by Anonymous Monk
on Mar 25, 2001 at 08:08 UTC ( #66949=categorized answer: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use POSIX qw(ceil);
    print ceil(3.5);   # prints 4
    print ceil(4);     # also prints 4
    
  2. or download this
    sub roundup {
        my $n = shift;
        return(($n == int($n)) ? $n : int($n + 1))
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and dust plays in a shaft of sunlight...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2017-01-17 21:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (158 votes). Check out past polls.