14 lines
299 B
Text
14 lines
299 B
Text
-- As for built-in power() function:
|
|
-- base can be either integer or float; returns float.
|
|
on pow (base, exp)
|
|
if exp=0 then return 1.0
|
|
else if exp<0 then
|
|
exp = -exp
|
|
base = 1.0/base
|
|
end if
|
|
res = float(base)
|
|
repeat with i = 2 to exp
|
|
res = res*base
|
|
end repeat
|
|
return res
|
|
end
|