use POSIX 'floor'; sub round { my $x = shift; floor($x + 0.5); }
You can use int instead of POSIX::floor if you don't need to round negative numbers. Anyway, read the docs for the int operator in perlfunc man page.
In reply to Re: Rounding off numbers
by salva
in thread Rounding off numbers
by tamaguchi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |