09-16-2022, 02:56 AM
Well back to working with Euler approximations. So based on his work, I put together what I think is a pretty cool way to get decimal roots like 7^2.3, 8 ^.7, etc. calculated without using logs.
So if this works, it can be adopted to use with string math routines I have already made.
DECIMAL POWERS ROUTINE
Pete
So if this works, it can be adopted to use with string math routines I have already made.
DECIMAL POWERS ROUTINE
Code: (Select All)
WIDTH 120, 42
_SCREENMOVE 0, 0
DO
INPUT "Number: "; num
LINE INPUT "Power: "; power$
IF INSTR(power$, ".") THEN
t = VAL(MID$(power$, INSTR(power$, ".")))
power$ = MID$(power$, 1, INSTR(power$, ".") - 1)
a = 1
b = num
x = 0
y = 1
highc = b
lowc = a
highz = 1
DO
t1 = a * b
c = SQR(t1)
t1 = x + y
z = t1 / 2
IF z = t THEN EXIT DO
IF z > t THEN
highz = z: highc = c
ELSEIF z < t THEN
lowz = z: lowc = c
END IF
PRINT a, b, highc, lowc, z, highz, lowz
a = highc: b = lowc
x = highz: y = lowz
LOOP
IF LEN(power$) THEN
a = num ^ VAL(power$) * a
END IF
PRINT "Results = "; a
ELSE
PRINT "Results = "; num ^ VAL(power$)
END IF
PRINT
LOOP
Pete