HP-35S programming - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: HP-35S programming (/thread-139653.html) |
HP-35S programming - Antonio Maschio (Italy) - 08-08-2008 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 - George Bailey (Bedford Falls) - 08-08-2008 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 - MikeO - 08-18-2008 I can't see a way to programmatically set the display format in an elegant way.
Re: HP-35S programming - George Bailey (Bedford Falls) - 08-19-2008 Quote: 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 - Palmer O. Hanson, Jr. - 08-20-2008 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. 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 - Paul Dale - 08-20-2008 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 - Palmer O. Hanson, Jr. - 08-20-2008 I did it another way which yields the number of digits in A: Z001 LBL Z Re: HP-35S programming - MikeO - 08-20-2008
Quote: 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!
Re: HP-35S programming - George Bailey (Bedford Falls) - 08-21-2008 Quote: 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, Re: HP-35S programming - Paul Dale - 08-24-2008 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 - George Bailey (Bedford Falls) - 08-25-2008 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. ;-)
|