(20S and 21S) RPN Simulator - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (20S and 21S) RPN Simulator (/thread-8471.html) |
(20S and 21S) RPN Simulator - Eddie W. Shore - 06-08-2017 01:03 PM This program will allow the user to simulate RPN (Reverse Polish Notation) for five arithmetic functions: addition, subtraction, multiplication, division, and exponentiation (power). All operations take the form of enter Y, press [INPUT], enter X, [XEQ] (appropriate key). Labels: XEQ A: Y + X XEQ B: Y – X XEQ C: Y * X XEQ D: Y/X XEQ E: Y^X XEQ F: “clears” the stack. The result shown in the display while the X value is left in the hidden display, which can be accessed by pressing [ LS ] (SWAP). The key codes for the HP 20S and HP 21S are the same. Code:
Example: In the following examples, 8 will be stored in the hidden register. 7 + 8: 7, INPUT, 8, XEQ A. Result: 15 7 – 8: 7, INPUT, 8, XEQ B. Result: -1 7 * 8: 7, INPUT, 8, XEQ C. Result: 56 7/8: 7, INPUT, 8, XEQ D. Result: 0.375 7^8: 7, INPUT, 8, XEQ E. Result: 5,764,801 |