Post Reply 
Result of HP 50g code
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
Post Reply 


Messages In This Thread
Result of HP 50g code - John Casper - 08-23-2024, 05:50 PM
RE: Result of HP 50g code - DavidM - 08-23-2024 11:06 PM
RE: Result of HP 50g code - John Casper - 08-24-2024, 03:45 AM



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