I find it hard to believe that there is nothing on the internet for writing a logarithmic function... that actually works.
I found one example code that will give a correct result for say log base 2 for 16 as 4. Because 2 to the 4th power is 16. But log base 10 for 5 produces 0.00000 instead of 0.69897.
FUNCTION LOGN(a AS FLOAT,b AS FLOAT)
n AS FLOAT
i AS FLOAT
g AS FLOAT
g=a
n=0
i=1
while (EXP(b,i) <> 1)
while g >= EXP(b,i)
g=g/EXP(b,i)
n=n+i
endwhile
i=i/b
endwhile
ENDFUNCTION n
FUNCTION EXP(num AS FLOAT,exponent AS FLOAT)
m AS FLOAT
m=1
for ee=1 to exponent
m=m*num
next ee
ENDFUNCTION m
I found an equation for natural logarithm but it only works when the number is between 0 and 2.
Why wouldn't there be any math functions in AppGameKit?? How would I move an object in a spiral without any trigonometric functions??
www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)