Post Reply 
EXC/ x<>Rn for stack efficiency
06-15-2017, 09:01 AM (This post was last modified: 06-15-2017 10:36 AM by Dieter.)
Post: #21
RE: EXC/ x<>Rn for stack efficiency
(06-14-2017 11:31 PM)Matt Agajanian Wrote:  Great Circle Navigation

This is a classic example for what I said earlier. Try to understand how the program works and recode it. This will for instance show that the complete routine in the first steps (which is called several times as SBR 00) is obsolete since it does a simple d.ms to decimal degrees conversion (e.g. it turns 42°50' into 42,8333°). The 25 and 33 have a dedicated function for this.

Regarding the EXC instruction: that's obsolete as well. Take a look at the code. In line 84/85 an inverse cosine is calculated and stored in R2 while the previous content oF R2 is recalled and checked whether its sine is > 0. If not, 360 minus the previous result is returned. You could replace the EXC instruction with the code in my first post, so a literal translation would look this way:

Code:
...
COS^-1
RCL 2
X<>Y
STO 2
R↓
SIN
X>0?
GTO nn  // jump to the final RCL 2
3
6
0
RCL 2
-
STO 2
RCL 2   // jump target
RTN

But this is not required. In RPN this can be done more elegantly since the previous result is still on the stack:

Code:
...
COS^-1
RCL 2
SIN
X>0?
GTO nn  // jump to the final R↓
R↓
CHS
3
6
0
+
ENTER
R↓      // jump target
RTN

The complete program can be turned into a more compact HP25/33 version. But I am sure that HP25 great circle programs already exist. ;-)

Edit: a direct translation of the 100-step SR56 program is hard to do in 49 steps. However, if the final 360–x procedure is omitted it will fit. Otherwise a few more steps are required.

Edit2: I see the SR56 program calculates the great circle distance in nautical miles which is diplayed in step 62. But what is the angle that is calculated afterwards and returned as the second result? Matt, can you post the instructions and an example for this program?

Dieter
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-15-2017 09:01 AM



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