Post Reply 
Adapting 'Accurate' TVM routine on HP-15C (and HP-34C) using MISO Technique
01-11-2014, 05:53 AM (This post was last modified: 01-11-2014 04:09 PM by Thomas Klemm.)
Post: #21
RE: Adapting 'Accurate' TVM routine on HP-15C using MISO Technique
(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.
Find all posts by this user
Quote this message in a reply
01-11-2014, 03:48 PM
Post: #22
RE: Adapting 'Accurate' TVM routine on HP-15C using MISO Technique
(01-11-2014 05:53 AM)Thomas Klemm Wrote:  ENTER
ENTER
RCL 3
*

Or:
ENTER
X<>Y
RCL 3
*
...and one additional X<>Y afterwards.

This is even one step shorter:
...
RCL 3
X<>Y
*
LastX
...

Dieter
Find all posts by this user
Quote this message in a reply
01-11-2014, 04:11 PM
Post: #23
RE: Adapting 'Accurate' TVM routine on HP-15C using MISO Technique
(01-11-2014 03:48 PM)Dieter Wrote:  This is even one step shorter:
RCL 3
X<>Y
*
LastX
Nice catch! Updated my listing.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
01-11-2014, 04:26 PM (This post was last modified: 01-11-2014 04:27 PM by Jeff_Kearns.)
Post: #24
RE: Adapting 'Accurate' TVM routine on HP-15C using MISO Technique
(01-11-2014 04:11 PM)Thomas Klemm Wrote:  Nice catch! Updated my listing.

Cheers
Thomas

And I mine - in the software section!
Jeff
Find all posts by this user
Quote this message in a reply
01-11-2014, 06:25 PM
Post: #25
RE: Adapting 'Accurate' TVM routine on HP-15C using MISO Technique
(01-11-2014 04:11 PM)Thomas Klemm Wrote:  Nice catch! Updated my listing.

Now let's see if we can do something with the %-function instead of dividing x by 100. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)