Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -0,0 +1,13 @@
|
|||
sub ex {
|
||||
my($base,$exp) = @_;
|
||||
die "Exponent '$exp' must be an integer!" if $exp != int($exp);
|
||||
return 1 if $exp == 0;
|
||||
($base, $exp) = (1/$base, -$exp) if $exp < 0;
|
||||
my $c = 1;
|
||||
while ($exp > 1) {
|
||||
$c *= $base if $exp % 2;
|
||||
$base *= $base;
|
||||
$exp >>= 1;
|
||||
}
|
||||
$base * $c;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue