PrgCalcPro: Fibonacci Number
F_n = F_n-1 + F_n-2 via formula ((1+√5)^n) - (1-√5)^n)/(2^n * √5)
Sequence where F0 = 0, F1= 1, F2 = 2, etc.
Note: PrgCalcPro, like the MK-61 calculator, has the power function x^y. That is, x has the base and y is the exponent. On the ProCalcPro, then the power function is executed, the exponent remains on the y stack and not "consumed".
Example:
Y: 5
X: 2
Executing x^y leaves
Y: 5
X: 32 (2^5)
Program:
0: 40 ; M0
1: 01 ; 1
2: 0E ; ^ // E^
3: 05 ; 5
4: 21 ; sqr // √
5: 10 ; +
6: 24 ; X^Y
7: 14 ; XY // swap
8: 01 ; 1
9: 0E ; ^ // E^
10: 05 ; 5
11: 21 ; sqr // √
12: 11 ; -
13: 24 ; X^Y
14: 14 ; XY // swap
15: 25 ; REV // roll down
16: 11 ; -
17: 60 ; R0
18: 02 ; 2
19: 24 ; X^Y
20: 14 ; XY // swap
21: 25 ; REV // roll down
22: 05 ; 5
23: 21 ; sqr // √
24: 12 ; *
25: 13 ; /
26: 50 ; STOP
This blog is property of Edward Shore, 2016.