Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: how to always round up in perl?

by chrestomanci (Priest)
on Feb 25, 2011 at 09:19 UTC ( #890150=note: print w/ replies, xml ) Need Help??


in reply to Re: how to always round up in perl?
in thread how to always round up in perl?

That fails if $n is allready an integer. You would need something like:

my $n = 3.0; my $ceiling = int($n); $ceiling += 1 if $ceiling != $n;

Or as a one liner:

my $ceiling = int($n) + ($n != int($n));


Comment on Re^2: how to always round up in perl?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://890150]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2015-07-30 02:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls