Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Answer: How do I round up a number?

by Tiefling (Monk)
on Jun 11, 2001 at 18:30 UTC ( #87503=categorized answer: print w/replies, xml ) Need Help??

Q&A > math > How do I round up a number? - Answer contributed by Tiefling

My preferred answer if you insist on rounding up is the second one given by Anonymous Monk above. However, it's best to round to the nearest integer, in which case int($n+0.5) is your friend.

Tiefling

Replies are listed 'Best First'.
Re: Answer: How do I round up a number?
by I0 (Priest) on Jun 11, 2001 at 20:02 UTC
    That fails for negative numbers.
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[Discipulus]: beer is good water can be dangerous..

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2016-12-06 12:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (102 votes). Check out past polls.