Post Reply 
HP 48G - RCLF and STOF
09-05-2021, 10:32 PM
Post: #1
HP 48G - RCLF and STOF
I had no idea that the list returned by invoking the RCLF command also represents display values. I used RCLF and STOF as bookends in a few programs that I was toying with. I set the display value to 2 FIX on the first one and 4 FIX on the second one. To my surprise, the second program displayed the output in 2 FIX. I executed the programs in order. Please explain. Also, is it possible to examine the list and decipher it? RCLF returns
{
# 801400000004FF2h
# E0h }
Find all posts by this user
Quote this message in a reply
09-05-2021, 11:28 PM
Post: #2
RE: HP 48G - RCLF and STOF
To quote the 48G AUR entry for RCLF:

"Recall flags command: Returns a list containing two 64-bit binary integers representing the states of the 64 system and user flags, respectively."

The first binary integer in the returned list is the system flags, where each bit represents one flag (and the lowest flag is in the rightmost bit). For example, the user flag value you got, #E0h, is #11100000b. This means that user flags 6, 7, and 8 are all set, while all other user flags are clear.

MNH Wrote:I had no idea that the list returned by invoking the RCLF command also represents display values.

It does because system flags -45 through -48 determine how many digits of precision are displayed, while system flags -49 and -50 determine what display mode to use: FIX, SCI, ENG, or ALL. This transparency is part of why the HP 48 is so cool. Smile

MNH Wrote:To my surprise, the second program displayed the output in 2 FIX. I executed the programs in order.

I agree that what you're describing doesn't make sense. Can you post your source code?
Find all posts by this user
Quote this message in a reply
09-06-2021, 03:15 AM (This post was last modified: 09-06-2021 03:31 AM by MNH.)
Post: #3
RE: HP 48G - RCLF and STOF
(09-05-2021 11:28 PM)Liam Hays Wrote:  I agree that what you're describing doesn't make sense. Can you post your source code?

Original source code is from https://groups.google.com/g/comp.sys.hp4...4wlp9eT-MJ .

Current number format is set to 4 FIX.

P->R

\<< RCLF ROT ROT -16
SF HMS\-> \->V2 -16 CF
V\-> 2 FIX "SIDE 1"
\->TAG SWAP "SIDE 2"
\->TAG ROT STOF
\>>

Input

2: 500.0000 @ Diagonal distance or hypotenuse
1: 36.5212 @ Interior angle

Output

2: SIDE 1: 300.0007 @ Side opposite from interior angle
1: SIDE 2: 399.9995 @ Side adjacent to interior angle

Note that despite the 2 FIX, output is in 4 FIX. Why?

From the HP 48G Series AUR appendix C:

Flag -50 Fix: -49 set, -50 clear.

How do I need to set/clear flags -49 and -50 to make my code work correctly?
Find all posts by this user
Quote this message in a reply
09-06-2021, 01:04 PM
Post: #4
RE: HP 48G - RCLF and STOF
Just a guess here, but possibly because the program ends with STOF, which restores the original FIX 4 setting, that display mode is used to format the resulting stack contents.

Try removing the STOF (replace it with a DROP) and I think you'll see it is as you want.

In order to keep the STOF (and thereby preserve the original setting) you could modify the program to convert your results to strings, which would not be affected by the display mode.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
09-07-2021, 12:30 AM (This post was last modified: 09-07-2021 12:35 AM by MNH.)
Post: #5
RE: HP 48G - RCLF and STOF
@ rprosperi

\<< 2 FIX RCLF ROT
ROT -16 SF HMS\-> \->V2
-16 CF V\-> "SIDE 1"
\->TAG SWAP "SIDE 2"
\->TAG ROT STOF
\>>

This is my fix. I want the results on the stack, therefore no strings. Concerning RCLF and STOF, I was just following the suggestion of the original poster. I have a grasp of what's going on now. Thanks for your help!
Find all posts by this user
Quote this message in a reply
09-07-2021, 01:01 AM (This post was last modified: 09-07-2021 01:05 AM by Joe Horn.)
Post: #6
RE: HP 48G - RCLF and STOF
(09-07-2021 12:30 AM)MNH Wrote:  @ rprosperi

\<< 2 FIX RCLF ROT
ROT -16 SF HMS\-> \->V2
-16 CF V\-> "SIDE 1"
\->TAG SWAP "SIDE 2"
\->TAG ROT STOF
\>>

This is my fix. I want the results on the stack, therefore no strings. Concerning RCLF and STOF, I was just following the suggestion of the original poster. I have a grasp of what's going on now. Thanks for your help!

I don't understand. Didn't you include RCLF and STOF in the program so that the display setting would be restored to whatever it had been before the program ran? But the above program always changes the display setting to FIX 2 and leaves it that way when the program exits.

In case you prefer FIX 4 to be the display setting but want these particular outputs to be displayed to two decimal places, don't include FIX in your program at all, but instead insert 2 RND after the V\-> and the SWAP.

<0|ΙΈ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
09-08-2021, 12:46 AM
Post: #7
RE: HP 48G - RCLF and STOF
(09-07-2021 01:01 AM)Joe Horn Wrote:  I don't understand. Didn't you include RCLF and STOF in the program so that the display setting would be restored to whatever it had been before the program ran?

In the beginning I was only concerned with flag -16, but now I understand that the display settings are controlled by system flags. I would prefer my tagged output be in 2 FIX. Although I normally work in 4 FIX, it's a minor inconvenience for me to go back to it. Sometimes it's nice to have the output reside on the stack so that the user can do some calculations with it.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)