# $rounded = round($value, $places); sub round { my ($N,$P) = @_; my $pm = $N > 0 ? 1 : -1; return int($N * 10**$P + .5 * $pm) / 10**$P; }
In reply to Re: Rounding without int() or printf()
by japhy
in thread Rounding without int() or printf()
by Mandor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |