Q&A > math
Description:
int($num) rounds a number down, but there dosen't seem to be any function to round a number up. int($num + 1) works ok for fractional values, but dosen't work right for integers. How can I round numbers up in a way that works for all numbers?Answer: How do I round up a number? contributed by Anonymous Monk Use the POSIX module: or, you can use this function:

Answer: How do I round up a number? contributed by damian1301 Heh, go check out the Math::Round module...probably more efficient. 
Answer: How do I round up a number? contributed by powerman See all roundlike perl functions here. 
Answer: 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. 
Please (register and) log in if you wish to add an answer
 a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
For:  Use:  
&  &  
<  <  
>  >  
[  [  
]  ] 