01-11-2014, 05:53 AM
(01-10-2014 10:50 PM)Jeff_Kearns Wrote: [ -> ]There must be some subtle stack lift thing going on that recall arithmetic avoids in the subsequent substitutions.
The problem is in these two lines:
021 ENTER
022 RCL * 3
If you just replace RCL * 3 with RCL 3, * then this will overwrite the value in register x since ENTER disabled the stack lift. Thus what we really need here is DUP. There are two possibilities you can circumvent this problem:
ENTER
ENTER
RCL 3
*
Or:
ENTER
X<>Y
RCL 3
*
But this is the only occurrence of this problem. In all the other situations RCL ? n can be replaced by just RCL n, ?.
In these situations a stack diagram is helpful.
001 LBL E \(x\) \(x\) \(x\) \(x\)
002 STO (i) \(x\) \(x\) \(x\) \(x\)
003 RCL 2 \(x\) \(x\) \(x\) \(i\%\)
004 EEX \(x\) \(x\) \(i\%\) \(1\)
005 2 \(x\) \(x\) \(i\%\) \(100\)
006 / \(x\) \(x\) \(x\) \(i\)
007 ENTER \(x\) \(x\) \(i\) \(i\)
008 ENTER \(x\) \(i\) \(i\) \(i\)
009 1 \(x\) \(i\) \(i\) \(1\)
010 + \(x\) \(x\) \(i\) \(1+i\)
011 LN \(x\) \(x\) \(i\) \(\ln(1+i)\)
012 X<>Y \(x\) \(x\) \(\ln(1+i)\) \(i\)
013 LSTx \(x\) \(\ln(1+i)\) \(i\) \(1+i\)
014 1 \(\ln(1+i)\) \(i\) \(1+i\) \(1\)
015 X≠Y \(\ln(1+i)\) \(i\) \(1+i\) \(1\)
016 - \(\ln(1+i)\) \(\ln(1+i)\) \(i\) \(i\)
017 / \(\ln(1+i)\) \(\ln(1+i)\) \(\ln(1+i)\) \(1\)
018 * \(\ln(1+i)\) \(\ln(1+i)\) \(\ln(1+i)\) \(\ln(1+i)\)
019 RCL 1 \(\ln(1+i)\) \(\ln(1+i)\) \(\ln(1+i)\) \(n\)
020 * \(\ln(1+i)\) \(\ln(1+i)\) \(\ln(1+i)\) \(n\ln(1+i)\)
021 e^x \(\ln(1+i)\) \(\ln(1+i)\) \(\ln(1+i)\) \((1+i)^n\)
022 RCL 3 \(\ln(1+i)\) \(\ln(1+i)\) \((1+i)^n\) \(B\)
023 X<>Y \(\ln(1+i)\) \(\ln(1+i)\) \(B\) \((1+i)^n\)
024 * \(\ln(1+i)\) \(\ln(1+i)\) \(\ln(1+i)\) \(B(1+i)^n\)
025 LSTx \(\ln(1+i)\) \(\ln(1+i)\) \(B(1+i)^n\) \((1+i)^n\)
026 1 \(\ln(1+i)\) \(B(1+i)^n\) \((1+i)^n\) \(1\)
027 - \(\ln(1+i)\) \(\ln(1+i)\) \(B(1+i)^n\) \((1+i)^n-1\)
028 RCL 4 \(\ln(1+i)\) \(B(1+i)^n\) \((1+i)^n-1\) \(P\)
029 * \(\ln(1+i)\) \(\ln(1+i)\) \(B(1+i)^n\) \(P((1+i)^n-1\))
030 EEX \(\ln(1+i)\) \(B(1+i)^n\) \(P((1+i)^n-1)\) \(1\)
031 2 \(\ln(1+i)\) \(B(1+i)^n\) \(P((1+i)^n-1)\) \(100\)
032 RCL 2 \(B(1+i)^n\) \(P((1+i)^n-1)\) \(100\) \(i\%\)
033 / \(B(1+i)^n\) \(B(1+i)^n\) \(P((1+i)^n-1)\) \(\frac{1}{i}\)
034 RCL 6 \(B(1+i)^n\) \(P((1+i)^n-1)\) \(\frac{1}{i}\) \(E\)
035 + \(B(1+i)^n\) \(B(1+i)^n\) \(P((1+i)^n-1)\) \(\frac{1}{i}+E\)
036 * \(B(1+i)^n\) \(B(1+i)^n\) \(B(1+i)^n\) \(P((1+i)^n-1)(\frac{1}{i}+E)\)
037 + \(B(1+i)^n\) \(B(1+i)^n\) \(B(1+i)^n\) \(B(1+i)^n+P((1+i)^n-1)(\frac{1}{i}+E)\)
038 RCL 5 \(B(1+i)^n\) \(B(1+i)^n\) \(B(1+i)^n+P((1+i)^n-1)(\frac{1}{i}+E)\) \(F\)
039 + \(B(1+i)^n\) \(B(1+i)^n\) \(B(1+i)^n\) \(B(1+i)^n+P((1+i)^n-1)(\frac{1}{i}+E)+F\)
040 RTN \(B(1+i)^n\) \(B(1+i)^n\) \(B(1+i)^n\) \(B(1+i)^n+P((1+i)^n-1)(\frac{1}{i}+E)+F\)
Yes, I've tested it and it works fine. The blinking is amazing!
Cheers
Thomas
Edit: Just noticed that Dieter already gave you an answer.