The Museum of HP Calculators

HP Forum Archive 18

[ Return to Index | Top of Index ]

HP-35S programming
Message #1 Posted by Antonio Maschio (Italy) on 8 Aug 2008, 4:42 a.m.

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

      
Re: HP-35S programming
Message #2 Posted by George Bailey (Bedford Falls) on 8 Aug 2008, 5:00 a.m.,
in response to message #1 by Antonio Maschio (Italy)

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...

      
Re: HP-35S programming
Message #3 Posted by MikeO on 18 Aug 2008, 9:33 p.m.,
in response to message #1 by Antonio Maschio (Italy)

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


MikeO

            
Re: HP-35S programming
Message #4 Posted by George Bailey (Bedford Falls) on 19 Aug 2008, 1:49 a.m.,
in response to message #3 by MikeO

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.

                  
Re: HP-35S programming
Message #5 Posted by Palmer O. Hanson, Jr. on 20 Aug 2008, 1:57 a.m.,
in response to message #4 by George Bailey (Bedford Falls)

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.
                        
Re: HP-35S programming
Message #6 Posted by Paul Dale on 20 Aug 2008, 4:33 p.m.,
in response to message #5 by Palmer O. Hanson, Jr.

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

                              
Re: HP-35S programming - another method
Message #7 Posted by Palmer O. Hanson, Jr. on 20 Aug 2008, 10:17 p.m.,
in response to message #6 by Paul Dale

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
                              
Re: HP-35S programming
Message #8 Posted by George Bailey (Bedford Falls) on 21 Aug 2008, 3:01 a.m.,
in response to message #6 by Paul Dale

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

                                    
Re: HP-35S programming
Message #9 Posted by Paul Dale on 24 Aug 2008, 5:49 p.m.,
in response to message #8 by George Bailey (Bedford Falls)

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

                                          
Re: HP-35S programming
Message #10 Posted by George Bailey (Bedford Falls) on 25 Aug 2008, 3:08 a.m.,
in response to message #9 by Paul Dale

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. ;-)

                        
Re: HP-35S programming
Message #11 Posted by MikeO on 20 Aug 2008, 10:34 p.m.,
in response to message #5 by Palmer O. Hanson, Jr.

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!


[ Return to Index | Top of Index ]

Go back to the main exhibit hall