03-17-2021, 08:27 AM
I tried to calculate pi with Gauss - Legendre algorithm. So this program input repetition count. there is program code below.
It error at "-> A B T NEXT". However I have to assign new a, b, t values for calculation.
Of course, I can assign global variable like 'A' STO, but I want to use local variable. Can't I assign a local variable inside a loop?
Code:
<< 1 2 √ INV 4 INV -> N A B T <<
0 N FOR X A B + 2 / A B * √ T 2 X ^ A A B + 2 / - SQ * - -> A B T NEXT
>> >>
Of course, I can assign global variable like 'A' STO, but I want to use local variable. Can't I assign a local variable inside a loop?