Posts: 416
Threads: 78
Joined: Mar 2006
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
Posts: 335
Threads: 12
Joined: Dec 2007
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...
Posts: 121
Threads: 21
Joined: Jun 2008
I can't see a way to programmatically set the display format in an elegant way.
MikeO
Posts: 335
Threads: 12
Joined: Dec 2007
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.
Posts: 901
Threads: 113
Joined: Jun 2007
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.
Posts: 3,229
Threads: 42
Joined: Jul 2006
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
Posts: 901
Threads: 113
Joined: Jun 2007
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
Posts: 121
Threads: 21
Joined: Jun 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.
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!
Posts: 335
Threads: 12
Joined: Dec 2007
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
Posts: 3,229
Threads: 42
Joined: Jul 2006
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
Posts: 335
Threads: 12
Joined: Dec 2007
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. ;-)