Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
function pow($a, [int]$b) {
|
||||
if ($b -eq -1) { return 1/$a }
|
||||
if ($b -eq 0) { return 1 }
|
||||
if ($b -eq 1) { return $a }
|
||||
if ($b -lt 0) {
|
||||
$rec = $true # reciprocal needed
|
||||
$b = -$b
|
||||
}
|
||||
|
||||
$result = $a
|
||||
2..$b | ForEach-Object {
|
||||
$result *= $a
|
||||
}
|
||||
|
||||
if ($rec) {
|
||||
return 1/$result
|
||||
} else {
|
||||
return $result
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue