Adding Instructions by Branching. HP 12C Platinum Financial Calculator, 12c
Add to My manuals278 Pages
advertisement
144 Section 10: Program Editing
Keystrokes
(ALG mode)
Þ
Display
+
:9
} fs
15000t t
013, Keys new instruction into program line 013.
014, Keys new instruction into program line 014.
015, 45 9 Keys new instruction into program line 015.
016, Keys new instruction into program line 016.
12,000.00
Sets calculator back to Run mode.
3,000.00
12,000.00
Twenty percent tax on $15,000 income.
Net income after 20% tax is subtracted from $15,000 income.
Adding Instructions by Branching
1. Press fs to set the calculator to Program mode.
2. Press gi. followed by three digits that specify the program line immediately preceding the point at which the new instruction(s) are being added — usually, the last program line to be executed before the added instruction(s). This sets the calculator to the proper program line for inserting a i instruction in the next step. This i instruction will replace whatever instruction was already stored there, but that instruction will be keyed back into program memory, to be executed just after the new instructions, in step
7.
3. Press gi followed by three digits that specify the second line after the last line you keyed into program memory. (Branching to the second line rather than to the first is necessary because the first line following the last program in program memory must contain a i000 instruction. The i000 instruction ensures that program execution will branch to line 000 and halt after the program is run.) For example, if the last line you keyed into program memory was line 010, you would press gi012 at this step, preserving the gi000 in line 011.
4. Press gi. followed by three digits that specify the last line you keyed into program memory.
5. Press gi000. This automatically converts a data storage register into seven additional lines of program memory (if there was not already a gi000 instruction remaining at the end of program memory), and it
File name: hp 12c pt_user's guide_English_HDPMF123E27 Page: 144 of 275
Printed Date: 2005/8/1 Dimension: 14.8 cm x 21 cm
Section 10: Program Editing 145
ensures that program execution will branch to line 000 after the program is run.
6. Key in the instruction(s) being added.
7. Key in the instruction that originally immediately followed the point at which the new instruction(s) are being added — that is, the first instruction to be executed after the added instruction(s). (This instruction was replaced by the i instruction keyed in at step 3.)
8. Press gi followed by three digits that specify the second line following the point at which the new instruction(s) are being added. This i instruction will cause program execution to branch back to the proper line within the original program.
Example: Continuing with the preceding example, suppose incomes less than or equal to $7,500 were not to be taxed. You could modify the program to check for this condition and stop at line 000, displaying the original income keyed in, by storing 7,500 in register R
3
and adding the following instructions between lines
000 and 001 (the added lines are the same in RPN and ALG modes):
:3~gogi000. Since there are more than four instructions between
(and including) the first line to be executed after the added instructions (line 001) and the last line you keyed into program memory (line 010 in RPN and line 016 in
ALG), it will require fewer keystrokes to add the new instructions by branching than to add them by replacement.
Keystrokes
(RPN mode)
Display fs gi.000 gi012 gi.010 gi000
Sets calculator to Program mode.
000, Sets calculator to program line immediately preceding point at which new instructions are being added. (In this particular example, this step could have been skipped since calculator was already set at the proper program line.)
001,43, 33, Branches to program line 012, the second line after last line of program.
010, Sets calculator to last line of program so that the gi000 instruction keyed in next will be stored as the last line of the current program.
011,43, 33, Ends the current program with a gi000.
File name: hp 12c pt_user's guide_English_HDPMF123E27 Page: 145 of 275
Printed Date: 2005/8/1 Dimension: 14.8 cm x 21 cm
146 Section 10: Program Editing
Keystrokes
(RPN mode)
:3
~ go gi000
:0
Display
43 34
Added instructions. gi002 fs
7500?3
6500t
15000t t
45 Keys in instruction immediately following point at which new instructions are being added. (This instruction was replaced in line
001 by gi012 instruction.)
017,43, 33, Branches back to second line (line
002) following point at which new instructions are being added.
12,000.00 Sets calculator back to Run mode.
7,500.00
6,500.00
3,000.00
12,000.00
Stores test value in register R
3
.
Runs program for income less than
$7,500. Display shows original income keyed in, indicating that tax is zero.
Tax on $15,000 income.
Net income after tax. This shows program still works for an income greater than $7,500 and less than
$20,000.
Keystrokes
(ALG mode) fs gi.000
Display
000,
Sets calculator to Program mode.
Sets calculator to program line immediately preceding point at which new instructions are being added. (In this particular example, this step could have been skipped since calculator was already set at the proper program line.)
File name: hp 12c pt_user's guide_English_HDPMF123E27 Page: 146 of 275
Printed Date: 2005/8/1 Dimension: 14.8 cm x 21 cm
Keystrokes
(ALG mode) gi018 gi.016 gi000
:3
~ go gi000
?9 gi002 fs
7500?3
6500t
15000t t
Section 10: Program Editing 147
Display
001,43, 33, Branches to program line 018, the second line after last line of program.
016, Sets calculator to last line of program so that the gi000 instruction keyed in next will be stored as the last line of the current program.
017,43, 33, Ends the current program with a gi000.
45
019,
43 34
Added instructions.
021,43, 33,
44 Keys in instruction immediately following point at which new instructions are being added. (This instruction was replaced in line
001 by gi018 instruction.)
023,43, 33, Branches back to second line (line
002) following point at which new instructions are being added.
12,000.00
7,500.00
Sets calculator back to Run mode.
6,500.00
Stores test value in register R
3
.
Runs program for income less than
$7,500. Display shows original income keyed in, indicating that tax is zero.
3,000.00
Tax on $15,000 income.
12,000.00
Net income after tax. This shows program still works for an income greater than $7,500 and less than
$20,000.
File name: hp 12c pt_user's guide_English_HDPMF123E27 Page: 147 of 275
Printed Date: 2005/8/1 Dimension: 14.8 cm x 21 cm
148 Section 10: Program Editing
The following illustration of the edited RPN program shows how program execution branches to the instructions added at the end of program memory, then branches back. While the actual program in ALG mode is different, the illustration does indicate the method used.
File name: hp 12c pt_user's guide_English_HDPMF123E27 Page: 148 of 275
Printed Date: 2005/8/1 Dimension: 14.8 cm x 21 cm
advertisement
Key Features
- Financial Pocket Black, Silver
- 10 digits
- Memory registers: 20
Related manuals
advertisement
Table of contents
- 3 Introduction
- 3 About This Handbook
- 4 Financial Calculations in the United Kingdom
- 4 For More Solutions to Financial Problems
- 15 Problem Solving
- 16 Getting Started
- 16 Power On and Off
- 16 Low-Power Indication
- 16 Adjusting the Display Contrast
- 16 The Keyboard
- 17 Keying in Numbers
- 17 Digit Separators
- 17 Negative Numbers
- 18 Keying in Large Numbers
- 18 Backspacing
- 19 The CLEAR Keys
- 20 Undo Operation
- 20 The RPN and ALG Keys
- 21 Simple Arithmetic Calculations in RPN Mode
- 22 Simple Arithmetic Calculations in ALG Mode
- 23 Chain Calculations in RPN Mode
- 26 Chain Calculations in ALG Mode
- 26 Parentheses Calculations
- 27 Storage Registers
- 27 Storing and Recalling Numbers
- 29 Clearing Storage Registers
- 29 Storage Register Arithmetic
- 31 Percentage and Calendar Functions
- 31 Percentage Functions
- 31 Percentages in RPN Mode
- 32 Percentages in ALG Mode
- 33 Net Amount in RPN Mode
- 33 Net Amount in ALG Mode
- 34 Percent Difference
- 35 Percent of Total in RPN Mode
- 36 Percent of Total in ALG Mode
- 37 Calendar Functions
- 37 Date Format
- 38 Future or Past Dates
- 40 Number of Days Between Dates
- 41 Basic Financial Functions
- 41 The Financial Registers
- 41 Storing Numbers into the Financial Registers
- 41 Displaying Numbers in the Financial Registers
- 42 Clearing the Financial Registers
- 42 Simple Interest Calculations
- 44 Financial Calculations and the Cash Flow Diagram
- 46 The Cash Flow Sign Convention
- 46 The Payment Mode
- 47 Generalized Cash Flow Diagrams
- 49 Compound Interest Calculations
- 49 Interest Rate
- 49 Calculating the Number of Payments or Compounding Periods
- 55 Calculating the Periodic and Annual Interest Rates
- 56 Calculating the Present Value
- 58 Calculating the Payment Amount
- 60 Calculating the Future Value
- 63 Odd-Period Calculations
- 69 Amortization
- 72 Additional Financial Functions
- 72 Discounted Cash Flow Analysis: NPV and IRR
- 73 Calculating Net Present Value (NPV)
- 78 Calculating Internal Rate of Return (IRR)
- 79 Reviewing Cash Flow Entries
- 80 Changing Cash Flow Entries
- 82 Bond Calculations
- 82 Bond Price
- 83 Bond Yield
- 84 Depreciation Calculations
- 86 Additional Operating Features
- 86 Continuous Memory
- 87 The Display
- 87 Status Indicators
- 87 Number Display Formats
- 88 Scientific Notation Display Format
- 90 Special Displays
- 90 Key in RPN Mode
- 91 Arithmetic Calculations With Constants
- 92 Recovering From Errors in Digit Entry
- 93 Statistics Functions
- 93 Accumulating Statistics
- 94 Correcting Accumulated Statistics
- 96 Standard Deviation
- 97 Linear Estimation
- 99 Weighted Mean
- 100 One-Number Functions
- 102 The Power Function in RPN Mode
- 102 The Power Function in ALG Mode
- 103 Programming
- 104 Programming Basics
- 104 Why Use Programs?
- 104 Creating a Program
- 106 Running a Program
- 108 Program Memory
- 108 Identifying Instructions in Program Lines
- 109 Displaying Program Lines
- 112 000 Instruction and Program Line
- 112 Expanding Program Memory
- 114 Setting the Calculator to a Particular Program Line
- 114 Executing a Program One Line at a Time
- 117 Interrupting Program Execution
- 117 Pausing During Program Execution
- 122 Stopping Program Execution
- 125 Branching and Looping
- 125 Simple Branching
- 126 Looping
- 129 Conditional Branching
- 139 Program Editing
- 139 Changing the Instruction in a Program Line
- 140 Adding Instructions at the End of a Program
- 142 Adding Instructions within a Program
- 142 Adding Instructions by Replacement
- 144 Adding Instructions by Branching
- 149 Multiple Programs
- 149 Storing Another Program
- 153 Running Another Program
- 155 Solutions
- 156 Real Estate and Lending
- 156 Annual Percentage Rate Calculations With Fees
- 159 Price of a Mortgage Traded at a Discount or Premium
- 161 Yield of a Mortgage Traded at a Discount or Premium
- 163 The Rent or Buy Decision
- 169 Deferred Annuities
- 171 Investment Analysis
- 171 Partial-Year Depreciation
- 171 Straight-Line Depreciation
- 176 Declining-Balance Depreciation
- 180 Sum-of-the-Years-Digits Depreciation
- 184 Full- and Partial-Year Depreciation with Crossover
- 191 Excess Depreciation
- 192 Modified Internal Rate of Return
- 194 Black-Scholes Formula for Valuing European Options
- 202 Leasing
- 202 Advance Payments
- 202 Solving for Payment
- 206 Solving for Yield
- 209 Advance Payments With Residual
- 209 Solving for Payment
- 212 Solving for Yield
- 213 Savings
- 213 Nominal Rate Converted to Effective Rate
- 215 Effective Rate Converted to Nominal Rate
- 216 Continuous Rate Converted to Effective Rate
- 217 Bonds
- 217 30/360 Day Basis Bonds
- 222 Annual Coupon Bonds
- 227 Appendices
- 228 Appendix A: RPN and the Stack
- 230 Termination of Digit Entry
- 230 Stack Lift
- 230 Rearranging Numbers in the Stack
- 231 One-Number Functions and the Stack
- 231 Two-Number Functions and the Stack
- 231 Mathematics Functions
- 232 Percentage Functions
- 233 Calendar and Financial Functions
- 234 Chain Calculations in RPN Mode
- 235 Arithmetic Calculations with Constants
- 237 Appendix B: Algebraic Mode (ALG)
- 237 Simple Arithmetic Calculations in ALG Mode
- 238 Chain Calculations in ALG Mode
- 239 Key in ALG Mode
- 239 The History Stack in ALG Mode
- 240 Parentheses Calculations
- 241 Percentage Functions
- 241 Percent Difference
- 242 Percent of Total
- 242 The Power Function
- 245 Appendix D: Error Conditions
- 245 Error 0: Mathematics
- 246 Error 1: Storage Register Overflow
- 246 Error 2: Statistics
- 246 Error 3: IRR
- 246 Error 4: Memory
- 247 Error 5: Compound Interest
- 248 Error 6: Storage Registers
- 248 Error 7: IRR
- 249 Error 8: Calendar
- 249 Error 9: Service
- 249 Pr Error
- 250 Appendix E: Formulas Used
- 250 Percentage
- 250 Interest
- 250 Simple Interest
- 251 Compound Interest
- 251 Amortization
- 252 Discounted Cash Flow Analysis
- 252 Net Present Value
- 252 Internal Rate of Return
- 252 Calendar
- 252 Actual Day Basis
- 252 30/360 Day Basis
- 253 Bonds
- 254 Black-Scholes Formula for Valuing European Options
- 254 Depreciation
- 255 Straight-Line Depreciation
- 255 Sum-of-the-Years-Digits Depreciation
- 255 Declining-Balance Depreciation
- 256 Modified Internal Rate of Return
- 256 Advance Payments
- 256 Interest Rate Conversions
- 256 Finite Compounding
- 256 Continuous Compounding
- 257 Statistics
- 257 Weighted Mean
- 257 Linear Estimation
- 257 Standard Deviation
- 257 Factorial
- 258 The Rent or Buy Decision
- 259 Battery
- 259 Low-Power Indication
- 260 Installing a New Battery
- 261 Verifying Proper Operation (Self-Tests)
- 263 Warranty
- 264 Service
- 265 Regulatory Information
- 266 Temperature Specifications
- 266 Noise Declaration
- 266 European Union
- 267 Appendix G: United Kingdom Calculations
- 267 Mortgages
- 268 Annual Percentage Rate (APR) Calculations
- 268 Bond Calculations
- 269 Function Key Index
- 272 Programming Key Index
- 274 Subject Index