HP 50G help
08-05-2016, 04:31 PM (This post was last modified: 08-05-2016 04:31 PM by Claudio L..)
Post: #41
 Claudio L. Senior Member Posts: 1,808 Joined: Dec 2013
RE: HP 50G help
(08-05-2016 02:44 PM)Hlib Wrote:  Can anybody explain me distinctions in use of system and user flags? I would like to get an example in the style like "1 minmarv".

System flags are a small permanent storage area for system settings. These settings control various behaviors of the calculator. The MODE / FLAGS UI is usually enough for you to know which flag controls what. The number on the left column of the list is the flag number to use with the commands SF/CF. (flags can only be set or clear, internally they are just one bit) System flags are negative, for example to turn Complex Mode ON you do:
-103 SF
and similarly -103 CF turns it off. In the MODE / FLAGS list you'll see 103 listed as complex mode.
User flags are exactly the same thing, except they are not used by the system, they are available for the user programs or libraries to use. Also, they are numbered using the positive numbers.
Your programs can use them more or less arbitrarily, bearing in mind they are "shared" by all programs/libraries so perhaps some of the libraries you install from hpcalc.org might be already using some of those flags to remember some settings.

Let's say you are writing a physics program. You could use a user flag for example to "remember" if the user prefers to use SI units or imperial units.
08-06-2016, 12:11 PM (This post was last modified: 08-06-2016 12:30 PM by Hlib.)
Post: #42
 Hlib Member Posts: 238 Joined: Jan 2015
RE: HP 50G help
I had to ensure a proper understanding of my operation correctly with HP-50g, if I type 5 3 / EXE or <<5 3 />> EVAL, the calculator returns the result of 5/3, because the system flag -105 = 0 (exact mode) only works in manual mode. The program returns to me, for example, for << 105 SF 5 3 / >> or for <<105 CF 5 3 />> 1.6666 ... or sometimes 5/3 no matter if the user flag 105 = 1 or =0. The program returns 5/3 or 1.666 ... arbitrarily regardless of the system/user flags. I threw one of my HP-50g and bought another. But the problem persists. Rev 2.15.
Claudio, you have a special HP-50g calculator?
08-06-2016, 02:47 PM
Post: #43
 Hlib Member Posts: 238 Joined: Jan 2015
RE: HP 50G help
(03-17-2016 10:41 PM)ttw Wrote:  ... 997 seems to small, 1000033 may be used.

May it be ".. 997 seems TOO small..." ? Or "to small" ?
08-06-2016, 03:26 PM (This post was last modified: 08-06-2016 04:08 PM by Vtile.)
Post: #44
 Vtile Senior Member Posts: 403 Joined: Oct 2015
RE: HP 50G help
(08-06-2016 12:11 PM)Hlib Wrote:  I had to ensure a proper understanding of my operation correctly with HP-50g, if I type 5 3 / EXE or <<5 3 />> EVAL, the calculator returns the result of 5/3, because the system flag -105 = 0 (exact mode) only works in manual mode. The program returns to me, for example, for << 105 SF 5 3 / >> or for <<105 CF 5 3 />> 1.6666 ... or sometimes 5/3 no matter if the user flag 105 = 1 or =0. The program returns 5/3 or 1.666 ... arbitrarily regardless of the system/user flags. I threw one of my HP-50g and bought another. But the problem persists. Rev 2.15.
Claudio, you have a special HP-50g calculator?

Did you mean
Code:
<< -105 SF 5 3 / >>
??? Exact mode can be used in programs also, I haven't found any hick-ups on that on UserRPL. Also regular 50g exact mode works differently if there is decimal number present. ie. there is difference how it works with calculations of
Code:
<< 5. 3 / >>
and
Code:
<< 5 3 / >>
while
Code:
<< 5. R->I 3 / >>
and
Code:
<< 5 3 / >>
should work the same. Also system flag -2 do enable partial "exact mode" for CAS, ie. if the calculation contains Pi symbol, it keeps the pi symbol and not give you aprox value, of the calculation until you use eval / ->num command.

R->I is command for converting real type numbers to integer type (get rid of that dot behind the number). XQ is another a bit different real / integer switch command.

Here is a small program to toggle between exact and approx mode. I did save it to one of the user keys for now.
Code:
 << -105 FS? -> X   << IF 'X==1' THEN -105 CF "EXACT MODE" 1 DISP 1 FREEZE        ELSE        -105 SF "APPROX MODE" 1 DISP 1 FREEZE END   >> >>
And here is a small program to toggle between symbolic vs. numeric constants. ( System Flag 2 )
Code:
 << -2 FS? -> X  << IF 'X==1' THEN -2 CF "Pi = Pi Mode" 1 DISP 1 FREEZE ELSE -2 SF "Pi = 3.142 Mode" 1 DISP 1 FREEZE  END  >>  >>
And here is a program to toggle between the cylindrical and Rectangular modes. Now with proper RPN / RPL IF structure. (Original author unknown, maybe mr. Linares or maybe derived from HP28 era.)
Code:
 << -16 FS? -> X << X 0 == IF THEN CYLIN ELSE RECT END >> >>
08-06-2016, 03:29 PM
Post: #45
 Massimo Gnerucci Senior Member Posts: 2,328 Joined: Dec 2013
RE: HP 50G help
(08-06-2016 12:11 PM)Hlib Wrote:  I had to ensure a proper understanding of my operation correctly with HP-50g, if I type 5 3 / EXE or <<5 3 />> EVAL, the calculator returns the result of 5/3, because the system flag -105 = 0 (exact mode) only works in manual mode. The program returns to me, for example, for << 105 SF 5 3 / >> or for <<105 CF 5 3 />> 1.6666 ... or sometimes 5/3 no matter if the user flag 105 = 1 or =0. The program returns 5/3 or 1.666 ... arbitrarily regardless of the system/user flags. I threw one of my HP-50g and bought another. But the problem persists. Rev 2.15.
Claudio, you have a special HP-50g calculator?

You are trying to set or clear a system flag, they are referred to with
negative integer numbers. So you have to -105 SF or -105 CF

No need to throw it away.

Greetings,
Massimo

-+×÷ ↔ left is right and right is wrong
08-06-2016, 07:23 PM (This post was last modified: 08-06-2016 07:25 PM by Claudio L..)
Post: #46
 Claudio L. Senior Member Posts: 1,808 Joined: Dec 2013
RE: HP 50G help
(08-06-2016 12:11 PM)Hlib Wrote:  I had to ensure a proper understanding of my operation correctly with HP-50g, if I type 5 3 / EXE or <<5 3 />> EVAL, the calculator returns the result of 5/3, because the system flag -105 = 0 (exact mode) only works in manual mode. The program returns to me, for example, for << 105 SF 5 3 / >> or for <<105 CF 5 3 />> 1.6666 ... or sometimes 5/3 no matter if the user flag 105 = 1 or =0. The program returns 5/3 or 1.666 ... arbitrarily regardless of the system/user flags. I threw one of my HP-50g and bought another. But the problem persists. Rev 2.15.
Claudio, you have a special HP-50g calculator?

There's more than flags going on in your example.
When you type a program, pay special attention to the trailing dots in numbers.
<< 5 3 / >> is not the same as << 5. 3. / >>
The compiler will generate one form or the other depending on flag -105 at *compile time*.
In the second form the numbers are reals. The operation on reals will always return 1.6666666... regardless of exact mode. Real numbers are not considered exact, hence you can't get an exact result from inexact numbers, even in exact mode.
In the first form, both numbers are exact, and the division of 2 exact numbers gives you a fraction (exact result) regardless of the mode.
Now EVAL does take the flag into consideration, so once you have '5/3' in the stack, if you do EVAL in exact mode you'll get the same '5/3', but in approx. mode EVAL will produce 1.66666...

It's quirky, the flag works as intended during compile and during EVAL, but once the program was compiled with exact or inexact numbers, the result is determined by the compiled code, regardless of state of the flag when you run the program (unless you use EVAL inside the program, that is...).
08-06-2016, 07:30 PM
Post: #47
 Claudio L. Senior Member Posts: 1,808 Joined: Dec 2013
RE: HP 50G help
(08-06-2016 12:11 PM)Hlib Wrote:  I threw one of my HP-50g and bought another.

Never EVER throw away a 50g. Even if it doesn't work, please consider donating it to the newRPL project before throwing it to the garbage. I'll pay for shipping if needed.
08-06-2016, 08:05 PM
Post: #48
 Hlib Member Posts: 238 Joined: Jan 2015
RE: HP 50G help
I thank for all your answers (Vtile, Massimo, Claudio). All this is very difficult for understanding of that why and where user (not system) flags work. I will study this question. Yes, I won't throw out HP-50g calculators in garbage any more.
08-06-2016, 09:31 PM
Post: #49
 DavidM Senior Member Posts: 814 Joined: Dec 2013
RE: HP 50G help
(08-06-2016 08:05 PM)Hlib Wrote:  All this is very difficult for understanding of that why and where user (not system) flags work. I will study this question.

It's actually very simple: User flags aren't used at all and are completely ignored by any built-in functions or modes on your 50g. As Claudio explained above, they are free for anyone to use as they see fit when writing their own programs and library functions.

While it's possible that there are some third-party programs and libraries which make use of User flag settings, there's not really a compelling reason to do so. RPL features such as local and global variables, implied boolean values of numbers (non-zero values are TRUE, zero is FALSE), and the availability of binary integers (eg. "# 1FFh") give more powerful and flexible alternatives to using User flags in most programming contexts. These features also produce code which is easier to understand and maintain, IMHO.
08-07-2016, 10:59 PM
Post: #50
 Joe Horn Senior Member Posts: 1,767 Joined: Dec 2013
RE: HP 50G help
(08-06-2016 09:31 PM)DavidM Wrote:  It's actually very simple: User flags aren't used at all and are completely ignored by any built-in functions or modes on your 50g.

Almost true. The 50g ships with HP's "Equation Library" installed in Port 2, which in my mind makes its functionality "built in". It uses USER flags 60, 61, 62, and 63.

TODAY'S TRIVIA: The HP 82211A "HP Solve Equation Library Application Card" for the HP 48SX uses USER flags 60, 61, and 62. When the "new, improved" version of the card came out (HP 82211B), they not only added Tetris and a few other goodies, but also added its use of USER flag 63. Since most of the functionality of that card was embedded in the 48GX, the G and GX also use those USER flags, as does the 49G, 49G+, and 50g, which have the same libraries. However, I'm fairly sure that the fact that USER flag 63 is used (and HOW it is used) has not been mentioned in any HP manuals other than the SX's 82211B card's "Manual Update" pamphlet (page 1-6) and the 50g AUR (page C-9), so it's a great feature that almost nobody knows about (namely, after setting USER flag 63, pressing right-shift followed by a variable's menu key TOGGLES it between not-defined and user-defined.)

<0|ɸ|0>
-Joe-
08-08-2016, 01:25 AM
Post: #51
 Vtile Senior Member Posts: 403 Joined: Oct 2015
RE: HP 50G help
Quote:TOGGLES it between not-defined and user-defined.
What this does mean? What is not-defined and what is user-defined??
08-08-2016, 02:41 AM
Post: #52
 DavidM Senior Member Posts: 814 Joined: Dec 2013
RE: HP 50G help
(08-07-2016 10:59 PM)Joe Horn Wrote:
(08-06-2016 09:31 PM)DavidM Wrote:  It's actually very simple: User flags aren't used at all and are completely ignored by any built-in functions or modes on your 50g.

Almost true. The 50g ships with HP's "Equation Library" installed in Port 2, which in my mind makes its functionality "built in". It uses USER flags 60, 61, 62, and 63.

I stand corrected! Thanks for pointing out these exceptions Joe (and the note on page C9 of the AUG, which I'd never noticed before).

I still find the model used by most other system functions for storing settings and data to be better than flag setting; namely, placing the parameters in an object/list and storing the object as a global variable (eg. IOPAR, PRTPAR, PPAR, ZPAR, TOFF, etc.). I will confess, though, that the propensity for these items to collect in HOME was what ultimately led me to using a var hider.
08-08-2016, 12:17 PM
Post: #53
 Joe Horn Senior Member Posts: 1,767 Joined: Dec 2013
RE: HP 50G help
(08-08-2016 01:25 AM)Vtile Wrote:
Quote:TOGGLES it between not-defined and user-defined.
What this does mean? What is not-defined and what is user-defined??

In the Multiple-Equation Solver, each variable gets its own menu key. The color of the menu label (white-on-black or black-on-white) indicates whether the user stored a value in it already ("user-defined") or whether it has not yet been assigned a value ("not-defined").

<0|ɸ|0>
-Joe-
08-09-2016, 11:32 PM
Post: #54
 rprosperi Senior Member Posts: 4,942 Joined: Dec 2013
RE: HP 50G help
(08-08-2016 02:41 AM)DavidM Wrote:  I will confess, though, that the propensity for these items to collect in HOME was what ultimately led me to using a var hider.

A simple and IMHO somewhat cleaner (than hidden vars) trick is to just move the newest object to the end of the list of objects stored in the current directory; this lets you retain it without having to see it, clutter-up the stuff you are working on, etc. Named TOLAST in my top level folder.

<< VARS 2 OVER SIZE 1 - SUB ORDER >>

In truth this moves the newest object to the penultimate object in the folder; TOLAST itself is last.

I can take no credit for this elegantly simple tool, I learned if from Joe, but I had to figure it out the hard way, finding a method to accomplish this with the smallest number of bytes. I did find one with fewer instructions, but it was larger.

--Bob Prosperi
08-10-2016, 01:44 AM
Post: #55
 DavidM Senior Member Posts: 814 Joined: Dec 2013
RE: HP 50G help
(08-09-2016 11:32 PM)rprosperi Wrote:  A simple and IMHO somewhat cleaner (than hidden vars) trick is to just move the newest object to the end of the list of objects stored in the current directory; this lets you retain it without having to see it, clutter-up the stuff you are working on, etc. Named TOLAST in my top level folder.

<< VARS 2 OVER SIZE 1 - SUB ORDER >>

In truth this moves the newest object to the penultimate object in the folder; TOLAST itself is last.

I can take no credit for this elegantly simple tool, I learned if from Joe, but I had to figure it out the hard way, finding a method to accomplish this with the smallest number of bytes. I did find one with fewer instructions, but it was larger.

That's truly a very compact piece of code! And of course you could make it even shorter by removing the "1 -" part so that it would truly move the first item into the last slot, then putting the TOLAST program itself into a library so that you could execute it as needed with any given directory without it having to protect itself.

Actually, I don't mind using and maintaining the var hider, and prefer that it totally hides the objects I feed to it. The occasional editing I have to do to it as I add more targets is easy. It's bigger, of course, but I've never even come close to running out of memory on my 50g for the things I use most often.

I still enjoy discovering new ways to do things on these devices, and continue to be impressed with the versatility of systems that were designed so long ago in "tech years".
 « Next Oldest | Next Newest »

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