Post Reply 
EXC/ x<>Rn for stack efficiency
06-14-2017, 06:39 PM (This post was last modified: 06-14-2017 06:45 PM by Dieter.)
Post: #16
RE: EXC/ x<>Rn for stack efficiency
(06-14-2017 10:19 AM)Matt Agajanian Wrote:  I've been trying to figure this out and I'm getting confused and forgetting the stack at the exchange steps. So, please help me. Maybe you've already responded with the answer. But, the ends I'm trying to accomplish removes the former value from the stack and leaves the exchanged value on the stack with Y, Z, and (if possible) the T registers intact.

This – leaving the whole stack or most of it unchanged – usually is not required at all. At least after some slight recoding usually you do not have to hold three intermediate values on the stack.

Example: Calculate R1 + R2*R3^R4 while pushing pi into R4

AOS      RPN
RCL      RCL 3
01       RCL 4
+        Pi
RCL      STO 4
02       R↓
*        y^x
RCL      RCL 2
03       *
y^x      RCL 1
Pi       +

RPN is different. You can do most calculations without having to keep track of lots of intermediate results – you always work with just two numbers. ;-)

(06-14-2017 10:19 AM)Matt Agajanian Wrote:  All I'm trying to do is leave the exchanged value in the X register without the forner register content in the Y register.

?!? After the exchange the former register content is in X of course.
That's what the EXC command does. As well as the four-step-code in my first post. Y and Z are preserved.

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

Messages In This Thread
RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-14-2017 06:39 PM

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