Post Reply 
Result of HP 50g code
08-23-2024, 05:50 PM (This post was last modified: 08-23-2024 05:50 PM by John Casper.)
Post: #1
Result of HP 50g code
I tried running the code given in the book HP 41-48 Transition,Pg 78 on the HP 50g emulator
in fix 4 mode approx
After pressing ON after some time the stack showed this weird symbol with B3H,and a constant
Is there a way to know what it means /book?


Attached File(s) Thumbnail(s)
       
Find all posts by this user
Quote this message in a reply
08-23-2024, 11:06 PM
Post: #2
RE: Result of HP 50g code
(08-23-2024 05:50 PM)John Casper Wrote:  Is there a way to know what it means /book?

Dr. Wickes' "HP41/HP48 Transitions" was written before the existence of an RPL calculator which had the "exact integer" object type. The problem you are experiencing comes from the program having exact integers as opposed to approximate numbers for the constants. As a result, the program is essentially running an infinite loop.

The determination of whether numbers with no fractional part are stored in programs as exact integers or real numbers is a combination of what is typed, along with the mode of the calculator at the time you are editing it. In this case, I can tell by looking at the second picture you attached that the program is using exact integers (note the lack of a decimal point after the 0s and -5).
Most likely, the program was typed in while the calculator was in exact mode, then at some point later you changed the mode to approximate (indicated by ~ in the header). Changing the mode affects calculations and operations performed from that point forward, but it doesn't change any previously-existing programs that were entered in a different mode.

It's possible to change all exact integers (numbers with no decimal point) in a program to approximate numbers (shown with a decimal point) by doing the following:
1- Set the calculator to approximate mode
2- Start editing a program that has exact integers
3- Save the program by pressing ENTER before any changes are actually made

The process of saving the program causes the built-in compiler to treat any numeric constants without a decimal point as approximate numbers (with a decimal point). Unfortunately, there's not an easy built-in way to go the reverse direction (approximate to exact), though I know of at least 1 user-contributed utility that will.

On the 50g, that program should look like this:
Code:
«
  0. 'N' STO
  0.
  DO
    DUP
    'N' INCR
    -5. ^ +
    SWAP
  UNTIL
    OVER ==
  END
»

Keep the calculator in approximate mode while going through that book -- it will make your life easier!
Find all posts by this user
Quote this message in a reply
08-24-2024, 03:45 AM
Post: #3
RE: Result of HP 50g code
Thanks for the informative answer
Find all posts by this user
Quote this message in a reply
Post Reply 




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