Q2X: Configure counter by variable

This commit is contained in:
Dennis Twardowsky
2019-10-18 22:54:24 +02:00
parent 39ee11b688
commit 7535181ac1

View File

@@ -1,8 +1,6 @@
00 { 164-Byte Prgm } 00 { 172-Byte Prgm }
01 LBL "Q2F" 01 LBL "Q2F"
02 SIZE 25
03 CLRG 03 CLRG
// Save Stack // Save Stack
@@ -37,104 +35,106 @@
29 STO 05 29 STO 05
// Init counter // Init counter
30 10 30 RCL "Q2MAX"
31 1000 31 X=0?
32 ÷ 32 12
33 0.00001 33 1000
34 + 34 ÷
35 STO 06 35 0.00001
36 10 36 +
37 STO 07 37 STO 06
38 10
39 STO 07
38 CLST 40 CLST
39 RCL 01 41 RCL 01
// [[A]] [LOOP-BEGIN] Build continued fraction // [[A]] [LOOP-BEGIN] Build continued fraction
40 LBL A 42 LBL A
41 ENTER 43 ENTER
42 IP 44 IP
43 STO IND 07 45 STO IND 07
44 X<>Y 46 X<>Y
45 FP 47 FP
46 STO 08 48 STO 08
// Check if configured tolerance is reached --> goto B // Check if configured tolerance is reached --> goto B
47 RCL 05 49 RCL 05
48 X>Y? 50 X>Y?
49 GTO B 51 GTO B
// .. if not, roll-down check value // .. if not, roll-down check value
50 R↓ 52 R↓
// ... and invert result for next round // ... and invert result for next round
51 1/X 53 1/X
// Increase REG-index // Increase REG-index
52 1 54 1
53 STO+ 07 55 STO+ 07
54 R↓ 56 R↓
// Proceed, if max num of rounds is reached --> repeat A // Proceed, if max num of rounds is reached --> repeat A
55 ISG 06 57 ISG 06
56 GTO A 58 GTO A
// [LOOP-END] Build continued fraction // [LOOP-END] Build continued fraction
57 GTO C 59 GTO C
// [[B]] FINISHED building continued fraction by tolerance // [[B]] FINISHED building continued fraction by tolerance
58 LBL B 60 LBL B
// Remove last stack entry used for tolerance check // Remove last stack entry used for tolerance check
59 R↓ 61 R↓
// [[C]] FINISHED building continued fraction by max num of rounds // [[C]] FINISHED building continued fraction by max num of rounds
60 LBL C 62 LBL C
// Init loop for reverse calculation from old value // Init loop for reverse calculation from old value
61 RCL 06 63 RCL 06
62 IP 64 IP
63 0.00001 65 0.00001
64 + 66 +
65 STO 06 67 STO 06
// Start calculation of final fraction // Start calculation of final fraction
// NOTE: 1. fraction always has nominator =1 // NOTE: 1. fraction always has nominator =1
66 CLST 68 CLST
67 1 69 1
68 RCL IND 07 70 RCL IND 07
69 PRSTK 71 PRSTK
// [[D]] [LOOP-BEGIN] Reverse calculation // [[D]] [LOOP-BEGIN] Reverse calculation
70 LBL D 72 LBL D
71 ENTER 73 ENTER
72 R↓ 74 R↓
73 X<>Y 75 X<>Y
74 R↑ 76 R↑
// Decrease REG-index // Decrease REG-index
75 1 77 1
76 STO- 07 78 STO- 07
77 CLX 79 CLX
78 RCL IND 07 80 RCL IND 07
79 × 81 ×
80 + 82 +
81 PRSTK 83 PRSTK
82 DSE 06 84 DSE 06
83 GTO D 85 GTO D
// [LOOP-END] Perform reverse calculation // [LOOP-END] Perform reverse calculation
// Prepare Alpha-Register // Prepare Alpha-Register
84 CLA 86 CLA
85 AIP 87 AIP
86 X<>Y 88 X<>Y
87 ⊢"/" 89 ⊢"/"
88 AIP 90 AIP
// Revert Stack // Revert Stack
89 RCL 04 91 RCL 04
90 RCL 03 92 RCL 03
91 RCL 02 93 RCL 02
92 RCL 01 94 RCL 01
// Show Result // Show Result
//90 AVIEW //90 AVIEW
93 END 95 END