Initializing Values in a Program (HP35s)


Suppose you need to initialize X=2 and Y=3 in a program. One method is:

001  2
002 STO X
003 3
004 STO Y

A second method is to use EQN before each line

001  2 -> X
002 3 -> Y

where -> is the STO command.

The second method obviously reduces the number of lines of code, but is one method any more efficient (timewise) over the other? I haven't been able to discern a difference in my small programs, so it's just really a matter of curiousity.



Create a loop and time it:


A001 100
A002 STO I
A003 your code here
An+1 GTO A003
An+2 RTN
This will run your code 100 times. Use a stopwatch to time it.

Edited: 3 Oct 2007, 1:03 p.m.


Y001 LBL Y

Y002 0.999

Y003 STO X

Y004 2

Y005 STO Y

Y006 ISG X

Y007 GTO Y004

Y008 RTN

Used 1m 8s

Y001 LBL Y

Y002 0.999

Y003 STO X

Y004 eq 2>Y

Y005 ISG X

Y006 GTO Y004

Y007 RTN

Used 1m 57s

Edited: 3 Oct 2007, 1:22 p.m.


Okay, I looped it 100 times.

11 seconds with

sto x
sto y

and 20 seconds with

2 -> x
3 -> y

Looks like there is definitely a trade-off with speed -vs- size.


The difference in length is only








Edited: 3 Oct 2007, 2:43 p.m.


Equation are parsed run time every time used, so clearly there will by an overhead.


I've not checked if this is the case here or not but don't trust the reported program lengths, they are wrong.

To measure sizes more accurately, try looking at the change in the bytes free in the memory menu.

- Pauli

Possibly Related Threads…
Thread Author Replies Views Last Post
  HP35s Program Four Slings Lift Calculation Jean-Marc Biram (Australia) 2 2,207 12-16-2013, 07:21 PM
Last Post: Jean-Marc Biram (Australia)
  HP35s Calculator Max Rope Tension Program Jean-Marc Biram (Australia) 10 4,369 12-12-2013, 12:03 AM
Last Post: Jean-Marc Biram (Australia)
  HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 2,699 11-11-2013, 08:28 PM
Last Post: Davi Ribeiro de Oliveira
  [HP Prime] Constants Library Values Timothy Roche 24 7,365 11-02-2013, 04:17 PM
Last Post: Les Koller
  HP 35s - multiple program input values? Arno 3 1,652 04-29-2013, 11:27 AM
Last Post: Gerson W. Barbosa
  Trouble entering a HP35s program line Arno 2 1,532 04-05-2013, 06:28 PM
Last Post: Arno
  HP35s scientific calculator GREG W THOMAS 4 1,908 03-22-2013, 06:49 AM
Last Post: Thomas Radtke
  [wp34s] Alternative MIO (allows calculations when entering element values) David Maier 1 1,064 02-03-2013, 02:51 PM
Last Post: Marcus von Cube, Germany
  DM-xxCC Default Display Values Mark Hardman 3 1,517 09-13-2012, 03:42 PM
Last Post: Lode
  HP35s "MEMORY CLEAR" flashes Mark Paris 1 1,485 08-31-2012, 07:35 PM
Last Post: Bart (UK)

Forum Jump: