sub round_up { my $n = shift; my $scale = 10**int(log($n)/log(10)); $n = 9 if $scale == 1; #magic for single digits if ($n > $scale) { $n = int($n/$scale+1)*$scale; } $n; }
In reply to Re: Rounding up nearest ten, hundred etc
by Roy Johnson
in thread Rounding up nearest ten, hundred etc
by nite_man
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |