Newbie Stack/Memory Management (33s)
#1

I posted last week about the sample vector operations that come in the 33s manual. It turned out my trouble wasnot being in ALG mode. I didn't like the idea of switching modes every time I wanted to do vector products, so I am rewriting in RPN. This also gives me the opportunity to restructure to match my workflow a little closer.
I am beginning to get a handle on how the programming language works, and I would appreciate some feedback on two methods for performing a simple task in one of my subroutines.

TASK: Display or Input U,V,W coordinates. (May be called independently or from another routine) Calculate and display magnitude of vector.

METHOD A:

INPUT U
X^2
INPUT V
X^2
+
INPUT W
X^2
+
SQRT
STO M
VIEW M

METHOD B

INPUT U
INPUT V
--> THETA, r
INPUT W
--> THETA, r
STO M
VIEW M

Advantages I see:
B: Shorter code. Easier to retype (slightly less resource usage, though both are tiny)
A: Only uses two lines of stack (I think) vs. 3 for B

I used STO M / VIEW M because I wanted to not have the time restriction of PSE. Is there a better way? I doubt I will ever need the variable to actually be stored.

Is there anything else that folks would think about when forming a little snippet like this? One wants to begin a new language with good habits.

Thanks

Adam



Possibly Related Threads…
Thread Author Replies Views Last Post
  HP 50g - select characters on the stack, copy/paste Sean Freeman 7 2,629 11-20-2013, 07:11 AM
Last Post: Sean Freeman
  Prime: Placing more than 1 item on the RPN stack in a single program? John Colvin 4 2,209 11-19-2013, 08:59 AM
Last Post: Miguel Toro
  emu48 - copy stack doesn't work (as expected) Thomas Radtke 2 1,932 11-11-2013, 02:19 PM
Last Post: Thomas Radtke
  HP Prime Stack operations from within a program John Colvin 1 1,344 11-08-2013, 09:45 PM
Last Post: Helge Gabert
  Prime: Anyway to refresh stack? kris223 5 2,081 10-16-2013, 05:09 PM
Last Post: kris223
  hp prime - sending program results to the stack giancarlo 6 2,046 10-15-2013, 02:00 AM
Last Post: Giancarlo
  HP Prime - RPN stack access from programs? Mike Mander (Canada) 10 3,319 09-30-2013, 11:20 AM
Last Post: steindid
  WP-34S: Stack after divide by 0 Marcel Samek 4 1,366 08-24-2013, 11:57 PM
Last Post: Paul Dale
  Little curiosity: why the fourth stack register is called "T"? Antlab 34 8,389 07-03-2013, 04:49 PM
Last Post: Walter B
  Is there a free RPN stack emulator for writing 35s programs Chris C 6 2,309 11-20-2012, 08:01 AM
Last Post: Mike (Stgt)

Forum Jump: