26 lines
705 B
Plaintext
26 lines
705 B
Plaintext
print " 11^5 = ", floatPow( 11, 5 )
|
|
print " (-11)^5 = ", floatPow( -11, 5 )
|
|
print " 11^( -5) = ", floatPow( 11, -5 )
|
|
print " 3.1416^3 = ", floatPow( 3.1416, 3 )
|
|
print " 0^2 = ", floatPow( 0, 2 )
|
|
print " 2^0 = ", floatPow( 2, 0 )
|
|
print " -2^0 = ", floatPow( -2, 0 )
|
|
|
|
end
|
|
|
|
function floatPow( a, b)
|
|
if a <>0 then
|
|
m =1
|
|
if b =abs( b) then
|
|
for n =1 to b
|
|
m =m *a
|
|
next n
|
|
else
|
|
m =1 /floatPow( a, 0 - b) ' LB has no unitary minus operator.
|
|
end if
|
|
else
|
|
m =0
|
|
end if
|
|
floatPow =m
|
|
end function
|