XP is just a number | |
PerlMonks |
Re: Answer: How do I round a number?by I0 (Priest) |
on Dec 16, 2000 at 02:38 UTC ( [id://46952]=note: print w/replies, xml ) | Need Help?? |
$rounded = int ( $orig + 0.5 ) assumes $rounded is positive. More generally: use POSIX; $rounded = floor ( $orig + 0.5 ) or $rounded = sprintf( "%.f" , $orig ) to properly handle the half-way case See also `perldoc -q round`
In Section
Seekers of Perl Wisdom
|
|