3 First Calculations in RPN
The stack rules become useful as soon as you have a calculation to do. This chapter takes you from entering one number to combining intermediate results, applying percentages, and repairing a mistake. The main value, S0 (called X), and the next register, S1 (called Y), are the two stack positions used by the next ordinary arithmetic operation. Open the full-stack view whenever you want to check both operands, then close it to continue.
The examples build on chapter 2. You do not need to plan every stack movement in advance: enter the numbers needed for one step, perform that step, and use its result in the next one. More extensive instruction in translating written expressions appears in chapter A.
3.2 Enter numbers, signs, and exponents
Powers of ten within a number
3.3 Add, subtract, multiply, and divide
3.4 Squares, roots, reciprocals, and powers
3.5 Continue from a result
3.6 Keep two intermediate results on the stack
3.7 Use the percentage keys
3.8 Correct an entry or recover operands
Correct digits while entering
Replace an accepted operand
Recover after the wrong operation
3.9 A short practice set
Answers and one possible sequence
3.10 Where to go next
3.1 Prepare a known starting state
Use the preparation procedure in section 2.2: RPN, real mode, a fixed five-register stack, 600 working digits, and FIX 4. If you have just completed the stack chapter, keep those settings. SpicyRPN restores saved work at launch, so check them if you are returning later. Angle units, date order, and payment timing do not affect this chapter’s answers.
Throughout this chapter, the prepared start means those settings, no active shift or pending command, and a stack cleared with f CLEAR. Repeat CLEAR before each independent example, but not between successive steps. Memories and the separate saved Last X/Last Y operands remain intact; the examples do not depend on their previous contents.
3.2 Enter numbers, signs, and exponents
Type integers and decimals in their usual digit order. Use the decimal point key even if your regional writing convention uses a comma. Thousands separators appear automatically; do not enter them. A leading decimal point is sufficient for a number smaller than one: .75 and 0.75 represent the same value.
To enter a negative number, type its magnitude and press +/\(-\) while ENTRY is showing. The subtraction key \(-\) performs an operation; it does not enter a minus sign. Pressing +/\(-\) again reverses the sign change. When no number is being entered, the same key negates the value already in X.
Try the independent rows of table 3.1, starting each from the prepared start. The final ENTER confirms the number, so the result uses FIX 4 rather than the unfinished entry’s appearance.
| Number | Keys after clearing | Display after ENTER |
| \(125\) | 125 ENTER |
125.0000 |
| \(0.75\) | .75 ENTER |
0.7500 |
| \(-12.5\) | 12.5 +/\(-\) ENTER |
-12.5000 |
Powers of ten within a number
EEX introduces the exponent in a number of the form \(a\times 10^b\). Enter the coefficient \(a\), press EEX, then enter the integer exponent \(b\). Do not type a multiplication sign or the number 10. For example, from the prepared start, f CLEAR 6.02 EEX 3 ENTER enters \(6.02\times 10^3\) and displays 6,020.0000.
While an exponent is active, +/\(-\) changes the exponent’s sign. To make both the coefficient and exponent negative, change the coefficient’s sign before pressing EEX. You can change the exponent’s sign either before or after its digits.
Enter a small negative number
Use the prepared RPN start. Enter \(-4\times 10^{-3}\) with:
f CLEAR 4 +/\(-\) EEX +/\(-\) 3 ENTER
The entry passes through -4 E+ and -4 E-3; after ENTER, the display is -0.0040. The first sign change belongs to 4; the second belongs to the exponent. In the same prepared state, f CLEAR 2.5 EEX +/\(-\) 3 ENTER gives 0.0025.
If no entry is active, EEX starts a new number with coefficient 1. Thus, from the prepared start, f CLEAR EEX 3 ENTER gives 1,000.0000. If you want to multiply an existing result by a power of ten, enter that power as a new operand and press \(\times \); EEX alone does not append an exponent to a completed result.
A second decimal point, a second EEX, or a decimal point within the exponent is ignored. An exponent with no digits is treated as zero when an RPN entry is accepted, so finish typing the intended exponent before pressing ENTER or a function. Backspace corrections are covered in section 3.8.
3.3 Add, subtract, multiply, and divide
For an ordinary two-number calculation, enter the first number, press ENTER, enter the second, and press the operator. The operator accepts the second number and immediately displays the result. No further ENTER is required.
For subtraction and division, enter the left-hand operand first: the calculator uses \(Y-X\) or \(Y/X\). Addition and multiplication use the same order, although reversing their two operands would give the same answer. In table 3.2, repeat the prepared start, including f CLEAR, before each row.
| Calculation | Keys after clearing | Display |
| \(27+15\) | 27 ENTER 15 + |
42.0000 |
| \(52-19\) | 52 ENTER 19 \(-\) |
33.0000 |
| \(2.4\times 3\) | 2.4 ENTER 3 \(\times \) |
7.2000 |
| \(7.5/2.5\) | 7.5 ENTER 2.5 \(\div \) |
3.0000 |
Negative operands follow the same pattern. To calculate \(-12.5+20\) from the prepared start, press f CLEAR 12.5 +/\(-\) ENTER 20 +. The display is 7.5000. The sign-change key belongs to the first number, while the final + combines the two numbers.
3.4 Squares, roots, reciprocals, and powers
Square, square root, and reciprocal need only X. For these real-number examples, use a nonnegative square-root input and a nonzero reciprocal input. Type the number and press the function; the function accepts the entry and replaces it with the result. Square root is a main key on the Scientific panel. Square, \(x^2\), is that key’s orange function. Reciprocal, \(1/x\), is in the fixed control row.
A general power needs two numbers. Enter the base first, then the exponent, and press the Scientific panel’s \(y^x\) key. Here Y is the base and X is the exponent. Table 3.3 gives complete examples after clearing; use the prepared start separately for each row.
| Calculation | Keys after clearing | Display |
| \(12^2\) | 12 f \(x^2\) |
144.0000 |
| \(\sqrt {81}\) | 81 \(\sqrt {x}\) |
9.0000 |
| \(1/8\) | 8 \(1/x\) |
0.1250 |
| \(2^5\) | 2 ENTER 5 \(y^x\) |
32.0000 |
You may apply another single-operand function directly to a result. For example, from the prepared start, f CLEAR 81 \(\sqrt {x}\) f \(x^2\) returns 81.0000. The result of square root becomes the operand of square.
A negative exponent is entered with the sign-change key just like any other negative number: f CLEAR 2 ENTER 3 +/\(-\) \(y^x\) gives 0.1250, since \(2^{-3}=1/8\). General roots, fractional powers, and other function domains are covered in chapter 7 and chapter 8.
3.5 Continue from a result
A result is already a usable number in X. To combine it with a new operand, type that operand and press the next operator. The first digit lifts the previous result into Y. You do not need ENTER between a completed result and a new number; an extra ENTER there would duplicate the result.
Calculate a subtotal, then adjust it
Use the prepared RPN start, including FIX 4 and no pending command. Calculate \((18.50+7.25)\times 3-5\) in these successive steps. Continue straight down the table without clearing between rows:
Keys |
Display |
f CLEAR 18.50 ENTER 7.25 + |
25.7500 |
3 \(\times \) |
77.2500 |
5 \(-\) |
72.2500 |
The first operation forms the subtotal, the second multiplies that subtotal, and the third subtracts 5 from the product.
The four displayed decimal places do not limit the value used in the next operation. For example, from the prepared start, f CLEAR 1 ENTER 3 \(\div \) shows 0.3333. Continuing with 3 \(\times \) shows 1.0000, because the multiplication uses the internally retained quotient. Re-entering 0.3333 would instead use that shorter approximation. See chapter 5 for the difference between displayed digits and working precision.
3.6 Keep two intermediate results on the stack
When a calculation has two parts, complete one part and leave its result on the stack while you calculate the other. The new entries move the first result deeper; completing the second part brings the two results together in Y and X.
Divide one subtotal by another
CalculateUse the prepared RPN start, real mode, fixed depth 5, FIX 4, and no pending shift or command. Press:
f CLEAR 18 ENTER 6 + 9 ENTER 5 \(-\) \(\div \)
The final display is 6.0000.
The numerator 24 waits while you enter 9 and 5. Subtraction consumes those two newer operands and leaves 4 in X, with 24 immediately above it in Y. The final division therefore uses \(24/4\). No memory register or parentheses key is needed.
| Position | After + | After 9 ENTER | After 5 | After \(-\) | After \(\div \) |
| S4 | 0 | 0 | 0 | 0 | 0 |
| S3 | 0 | 0 | 0 | 0 | 0 |
| S2 | 0 | 0 | 24 | 0 | 0 |
| S1/Y | 0 | 24 | 9 | 24 | 0 |
| S0/X | 24 | 9 | 5 | 4 | 6 |
You can pause after any step and open the full-stack inspector to check these positions; inspection does not finish an entry or move a value. If you accidentally calculate the denominator first, the final two results will be reversed. Use \(x\leftrightarrow y\) before division to restore numerator in Y and denominator in X. For systematic ways to choose an evaluation order for larger expressions, continue with chapter A.
3.7 Use the percentage keys
The blue functions of 1, 2, and 3 are %, \(\Delta \%\), and T%. All three use Y and X, but their stack behavior differs from multiplication or division: they replace X and leave Y and every deeper value in place.
Enter a rate of 15 percent as 15, not 0.15. Conversely, a percentage result of 15.0000 means 15 percent. Percentage change and percentage of a total require a nonzero original value or total.
| Function | Enter first, then second | Result in X |
| g % | Base \(Y\), percentage rate \(X\) |
\(YX/100\) |
| g \(\Delta \%\) | Original value \(Y\), new value \(X\) |
\(100(X-Y)/Y\) |
| g T% | Total \(Y\), part \(X\) |
\(100X/Y\) |
Add or subtract 15 percent of a price
Use the prepared RPN start, real mode and FIX 4, with no pending command. Find 15 percent of 80:
f CLEAR 80 ENTER 15 g %
The display is 12.0000; Y still holds 80.0000. Press + to add the increase and obtain 92.0000.
To apply a discount instead, repeat the complete sequence from CLEAR, then press \(-\) in place of +. The result is 68.0000. Both calculations reuse the retained base of 80; no second entry of 80 is needed.
Compare a new amount and find a share
Use the prepared RPN start for each of the following independent calculations, with no pending shift or command.For the change from 80 to 92, press:
f CLEAR 80 ENTER 92 g \(\Delta \%\)
The display is 15.0000: a 15 percent increase. Y remains 80. Replacing 92 with 68 in the same sequence gives -15.0000, a 15 percent decrease.
To find what percentage 50 is of a total of 200, press:
f CLEAR 200 ENTER 50 g T%
The display is 25.0000, and Y remains 200. The answer is 25 percent, not an amount of 25 in the original units.
Retaining the base makes % followed by + or \(-\) convenient. It also means that a completed percentage calculation leaves an extra operand behind. Inspect or deliberately clear the stack before starting unrelated work. Do not assume that a percentage function drops the stack like an ordinary two-operand operation.
3.8 Correct an entry or recover operands
Choose a correction according to whether the number is still being entered, has already been accepted, or has been used by an operation. The ENTRY indicator distinguishes the first two cases.
Correct digits while entering
With no pending shift or command, \(\leftarrow \) removes the last entry character. For example, from the prepared start, suppose you type 12.36 but mean 12.35. The complete correction and calculation are:
f CLEAR 12.36 \(\leftarrow \) 5 ENTER 7.65 +
The result is 20.0000. Backspace removes only the 6; the following 5 edits the same entry.
Within an exponent, backspace removes exponent digits first. After the last exponent digit has gone, one more backspace removes the entire exponent marker and its sign, returning to the coefficient. For example, from the prepared start, f CLEAR 2.5 EEX +/\(-\) 4 \(\leftarrow \) 3 ENTER gives 0.0025. It corrects \(2.5\times 10^{-4}\) to \(2.5\times 10^{-3}\). To change only an exponent’s sign, use +/\(-\) while that exponent is still active.
Deleting every character ends a real-number entry and leaves zero in its reserved X position. It does not undo the lift that started the entry. Once ENTRY disappears, backspace acts as CLx; it no longer removes digits from the displayed value. See section 2.8 for that distinction.
Replace an accepted operand
If the wrong operand is already accepted, drop it before entering its replacement. DROP is the orange function of the roll-down key. This preserves the other operand that was waiting in Y.
For example, use the prepared start and deliberately accept 6 where you meant 7:
f CLEAR 84 ENTER 6 ENTER f DROP 7 \(\div \)
The display is 12.0000. DROP exposes 84; typing 7 then lifts 84 back into Y, ready for division. The same replacement method works after you have erased an entry completely: drop the zero position, then enter the replacement.
Do not substitute CLx for DROP in this sequence. CLx leaves a zero in X; entering a new number would lift that zero into Y and move 84 another position deeper. CLEAR, by contrast, is useful when you intend to discard the whole calculation and start again.
Recover after the wrong operation
After a successful operation, LAST Y and LAST X can recover its saved operands. These saved values are separate from the current S1/Y and S0/X. Use them before another calculation or a clearing/recall command that changes those saved values. As explained in section 2.9, they recover operands rather than a complete earlier stack.
LAST Y is the blue function of \(1/x\); LAST X is the blue function of \(x\leftrightarrow y\). DROP and the two saved-operand recalls preserve both saved operands until the corrected operation uses them. Avoid CLx here: it saves the mistaken result as Last X, replacing the operand you need.
Repair one operation and keep an earlier subtotal
Use the prepared RPN start with fixed depth 5, real mode, FIX 4, and no pending command. You intend to calculate \((20+4)+(84/7)\), but press multiplication for the division:
f CLEAR 20 ENTER 4 + 84 ENTER 7 \(\times \)
The display is 588.0000. The earlier subtotal 24 is in Y; the saved operands are Last Y = 84 and Last X = 7. Immediately press:
f DROP g LAST Y g LAST X \(\div \) +
Dropping removes 588. The two recalls put 84 in Y and 7 in X, with 24 waiting in S2; division produces 12, and addition gives the intended 36.0000.
If the operation reported an error instead of producing a result, inspect the entry and stack before choosing a correction; do not assume that the preceding recovery sequence applies to every error. Chapter 14 covers error recovery.
3.9 A short practice set
Use the prepared start before each exercise: RPN, real mode, fixed depth 5, 600 working digits, FIX 4, no pending shift or command, and f CLEAR. Work out a sequence before looking at the answers. The settings and cleared start also apply to every answer sequence below.
- 1.
- Calculate \(35-8\), then divide that result by 3.
- 2.
- Calculate \(-6.5+2.25\).
- 3.
- Enter \(3.2\times 10^{-3}\), then multiply it by 250.
- 4.
- Calculate \(\sqrt {144}+1/4\).
- 5.
- Calculate \((15+9)/(8-2)\).
- 6.
- Calculate \(3^4\).
- 7.
- Reduce 120 by 12.5 percent.
- 8.
- Find the percentage change from 240 to 270.
Answers and one possible sequence
In table 3.6, each sequence starts after f CLEAR. Line breaks within an answer are only for readability; do not clear between the parts of a sequence.
| No. |
Keys after clearing |
Display |
| 1 |
35 ENTER 8 \(-\) 3 \(\div \) |
9.0000 |
| 2 |
6.5 +/\(-\) ENTER 2.25 + |
-4.2500 |
| 3 |
3.2 EEX +/\(-\) 3 ENTER 250 \(\times \) |
0.8000 |
| 4 |
144 \(\sqrt {x}\) 4 \(1/x\) + |
12.2500 |
| 5 |
15 ENTER 9 + 8 ENTER 2 \(-\) \(\div \) |
4.0000 |
| 6 |
3 ENTER 4 \(y^x\) |
81.0000 |
| 7 |
120 ENTER 12.5 g % \(-\) |
105.0000 |
| 8 |
240 ENTER 270 g \(\Delta \%\) |
12.5000 |
For exercise 4, square root leaves 12 waiting while reciprocal produces 0.25; addition combines them. For exercise 7, the percentage amount is 15 and the retained base is 120, so subtraction gives 105. For exercise 8, the increase is 30 on an original 240, giving \(100\times 30/240=12.5\) percent. These intermediate checks help locate an incorrect key before you repeat a whole calculation.
3.10 Where to go next
If the results are correct but the operand movements still feel unfamiliar, revisit chapter 2 with the full-stack inspector open between steps. For longer expressions and more practice, continue with chapter A. Chapter B discusses the reasons behind this style of calculation.
For everyday use, chapter 5 explains the digits you see, chapter 6 shows how to keep reusable values, and chapter 7 extends these basic functions. If you also want to enter written expressions, the next chapter introduces the independent ALG workspace.