Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
17
Task/Exponentiation-operator/11l/exponentiation-operator.11l
Normal file
17
Task/Exponentiation-operator/11l/exponentiation-operator.11l
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
F my_pow(base, exp) -> Float
|
||||
I exp < 0
|
||||
R 1 / my_pow(base, -exp)
|
||||
I exp == 0
|
||||
R 1
|
||||
V ans = base
|
||||
L 0 .< exp - 1
|
||||
ans *= base
|
||||
R ans
|
||||
|
||||
print(‘2 ^ 3 = ’my_pow(2, 3))
|
||||
print(‘1 ^ -10 = ’my_pow(1, -10))
|
||||
print(‘-1 ^ -3 = ’my_pow(-1, -3))
|
||||
print()
|
||||
print(‘2.0 ^ -3 = ’my_pow(2.0, -3))
|
||||
print(‘1.5 ^ 0 = ’my_pow(1.5, 0))
|
||||
print(‘4.5 ^ 2 = ’my_pow(4.5, 2))
|
||||
Loading…
Add table
Add a link
Reference in a new issue