Post Reply 
Micro challenge: improve this RPN code
12-18-2019, 04:15 PM
Post: #1
Micro challenge: improve this RPN code
While waiting for my Woodstock LP, I've been playing with my 29C and writing my own versions of some of the programs in the solutions packs. One of them, Gaussian Quadrature on page 22 of the Math pack takes numbers "a" and "b" on the stack in Y and X, and stores (a+b)/2 and (a-b)/2 in two registers like so:
ST+ 7
ST- 8
ST/ 7
ST/ 8
I look at my code and think "there must be a better way." Can you improve it?

The goal is for 29C code only. I won't list all the 29C instructions, but here are some important differences with earlier and later models:
Stack manipulation: X<>Y, RUP and RDN only. No direct stack STO/RCL
It has STO arithmetic, but not RCL arithmetic
It does have sigma+ and sigma-.
It doesn't matter which registers the results go in.

Looking forward to smacking my head and saying "why didn't I think of that!!" Smile

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

Messages In This Thread
Micro challenge: improve this RPN code - David Hayden - 12-18-2019 04:15 PM

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