13 lines
290 B
Text
13 lines
290 B
Text
with javascript_semantics
|
|
function powir(atom b, integer i)
|
|
atom res = 1
|
|
if i<0 then {b,i} = {1/b,abs(i)} end if
|
|
while i do
|
|
if and_bits(i,1) then res *= b end if
|
|
b *= b
|
|
i = floor(i/2)
|
|
end while
|
|
return res
|
|
end function
|
|
?powir(-3,-5)
|
|
?power(-3,-5)
|