HP-35S programming
#1

Hi,

I'm asking something that I'm not sure it's possible.

Suppose I have FIX 4 as default on my machine, varying format from time to time (FIX 2, SCI 9, STD, FIX 4 again, etc.)

Suppose I write a program that uses FIX 2 as default.

Is there a way to store actual format, use FIX 2, and restore precedent format at the end of the program?

I guess no, but I want to here from you before giving up.

Thanks in advance.

-- Antonio

#2

I don't know of any flag that indicates the FIX/SCI/ALL-status.

But I just thought of a way to at least check the FIX status at program start:

Take for instance 0.1111111111111, use RND on it to cut off any digit that is past the FIX value and than check for the first remaining digit. FIX 4 and RND would give 0.111100000000; FIX 6 and RND would give 0.111111000000 and so on...

#3

I can't see a way to programmatically set the display format in an elegant way.



MikeO

#4

Quote:
I can't see a way to programmatically set the display format in an elegant way.



MikeO


If you have found out the format that was preset in the way I described above, you then can do some comparison tests with the stored value and set the display format value again.

x ENTER /* put value in the display x register

[pseudo code snippet]

0

x=y?

FIX 0

RollDown

1

x=y?

FIX 1

RollDown

2

x=y?

FIX 2

...

Don't know if that's elegant enough, but should work nonetheless...

Edited: 19 Aug 2008, 2:34 a.m.

#5

Quote:
Don't know if that's elegant enough, but should work nonetheless...

In the "olden days" of machines such as the HP-41 and TI-59 which had FIX Ind capabilities we would have judged that a program with all that sequential code was distinctly non-elegant. Unfortunately, the powers that be didn't offer FIX Ind with the HP-35s so I suspect that your program is as elegant as one can get with that machine.
#6

An immediate improvement suggests itself: binary search the number of displayed digits. Branches are very cheap step count wise on the 35s.

I did this in a part of the rather long game I submitted soon after I received my 35s.

- Pauli

#7

I did it another way which yields the number of digits in A:

Z001  LBL Z
Z002 3
Z003 1/x
Z004 ENTER
Z005 RND
Z006 -
Z007 LOG
Z008 +/-
Z009 INTG
Z010 STO A
Z011 RTN
#8

Quote:
In the "olden days" of machines such as the HP-41 and TI-59 which had FIX Ind capabilities we would have judged that a program with all that sequential code was distinctly non-elegant.

That's about the size of it. Well, at least there's enough extra program memory to write a somewhat lengthy subroutine to do this. ;)

Good tips from everyone on this!

#9

Quote:
An immediate improvement suggests itself: binary search the number of displayed digits. Branches are very cheap step count wise on the 35s.

I did this in a part of the rather long game I submitted soon after I received my 35s.

- Pauli


Pauli,

even though I'm not the thread starter, I would be delighted if you could outline the binary search method a bit. I was not able to locate your submitted game in the articles or software section...

Thanks,
George Bailey

#10

Details about binary searches. Each comparison is eliminates half of the remaining possibilities.

The game is in the archives. Scroll down, you'll not miss it.

I submitted this and others programs to the software library ages ago but no sign of them there yet.

- Pauli

#11

Thanks, Pauli! I remember having seen that huge game of yours 'back in the days'. I must confess that I was a little reluctant to work through 700 lines - and still am! But thanks to wikipedia I at least now know what a binary search is. ;-)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Robotic Programming for 35s? David Hayden 9 2,560 11-13-2010, 04:10 PM
Last Post: Thomas Chrapkiewicz
  35s Programming (need help) Chuck 51 9,944 02-14-2008, 12:34 AM
Last Post: Karl Schneider
  35s Polar to rectangular programming Craig Ormandy 2 1,027 09-24-2007, 07:52 AM
Last Post: Jeff O.
  Custom Programming vs. Pre-packaged programming Eddie Shore 3 1,445 01-24-2005, 03:42 AM
Last Post: Karl Schneider

Forum Jump: