in reply to Best way to make sure a number is an even multiple of another?
sub fix { my $n = shift; # must be greater or equal to this (assert >= 0) my $m = shift; # must be multiple of this (assert > 0) $m*int(($n+$m-1)/$m); }
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Best way to make sure a number is an even multiple of another?
by demerphq (Chancellor) on Oct 21, 2004 at 13:14 UTC | |
by Arunbear (Prior) on Oct 21, 2004 at 14:01 UTC | |
by husker (Chaplain) on Oct 21, 2004 at 14:13 UTC | |
by Arunbear (Prior) on Oct 21, 2004 at 14:23 UTC | |
by thor (Priest) on Oct 21, 2004 at 14:32 UTC | |
by grinder (Bishop) on Oct 21, 2004 at 14:33 UTC | |
by husker (Chaplain) on Oct 21, 2004 at 14:33 UTC |
In Section
Seekers of Perl Wisdom