Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Answer: How do I round up a number?

( #87503=categorized answer: print w/ replies, xml ) Need Help??

Q&A > math > How do I round up a number? 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.


Comment on Answer: How do I round up a number?
Download Code
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?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2015-11-26 18:16 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (705 votes), past polls