Keep It Simple, Stupid | |
PerlMonks |
Re: Re: Question:by Anonymous Monk |
on Jun 25, 2002 at 18:23 UTC ( [id://177165]=note: print w/replies, xml ) | Need Help?? |
sub _round { my $digits = shift; my $num = shift; my $add = 5 * (10 ** -($digits + 1)); $num += $add; my ($int,$frac) = split /\./,$num; $frac = substr($frac, 0, $digits); $num = join '.', $int, $frac; return $num; }
In Section
Tutorials
|
|