HP 15c Scientific manual Flags,  n will clear flag number n

Page 92

92 Section 8: Program Branching and Controls

Following a conditional test, program execution follows the "Do if True" Rule: it proceeds sequentially if the condition is true, and it skips one instruction if the condition is false. A t instruction is often placed right after a conditional test, making it a conditional branch; that is, the t branch is executed only if the test condition is met.

Flags

Another conditional test for programming is a flag test. A flag is a status indicator that is either set (= true) or clear (= false). Again, execution follows the "Do if True" Rule: it proceeds sequentially if the flag is set, and skips one line if the flag is clear.

The HP-15C has eight user flags, numbered 0 to 7, and two system flags, numbered 8 (Complex mode) and 9 (overflow condition). The system flags are discussed later in this section. All flags can be set, cleared, and tested as follows:

Fn will set flag number n (0 to 9).

"n will clear flag number n.

?n will check if flag n is set.

A flag n that has been set remains set until it is cleared either by a " n instruction or by clearing (resetting) Continuous Memory.

Image 92
Contents HP-15C Owner’s Handbook HP Part Number 00015-90001 Edition 2.4, SepLegal Notice Introduction Contents Contents Display and Continuous MemoryProgram Editing Program Branching and ControlsSubroutines Calculating With Matrices Indirect Display ControlCalculating With Complex Numbers Numerical Integration Contents Appendix a Error Conditions Appendix C Memory AllocationAppendix D a Detailed Look at Appendix E a Detailed Look at fContents Appendix F Batteries Function Summary and IndexProgramming Summary and Index Subject IndexHP-15C Problem Solver Quick Look atManual Solutions To Compute Keystrokes DisplayProgrammed Solutions Keystrokes DisplayKeystrokesDisplay 001-42,21,11002 003 004 005 006 007 008 009 8313 300.51HP-15C a Problem Solver Part l HP-15C Fundamentals Power On and Off Getting StartedKeyboard Operation SectionPrefix Keys Changing SignsKeying in Exponents I O m ´ P I l F T s ? t H bClear Keys Clears only the last digit Display Clearing ` and −Digit entry not terminated Calculations One-Number FunctionsTwo-Number Functions 653217 + 26.0000 22.0000 500013.0000 78.0000Numeric Functions Number Alteration FunctionsOne-Number Functions General FunctionsPressing Calculates Trigonometric OperationsTime and Angle Conversions Degrees/Radians Conversions 7069Radians 40.5000Logarithmic Functions Hyperbolic FunctionsPower Function Two-Number FunctionsPercentages To Calculate Keystrokes DisplayPolar and Rectangular Coordinate Conversions Enters the base number the priceCalculates 3% of $15.76 the tax Polar Conversion. PressingKeystrokes Display Automatic Memory Stack Last X, and Data Storage Automatic Memory Stack Stack ManipulationAutomatic Memory Stack Registers Always displayedLost Stack Manipulation FunctionsMemory Stack, Last X, and Data Storage Lost Last X Register and K 287.000022.2481 12.900020.6475 Calculator Functions and the Stack13.9 + Order of Entry and the v Key +15 X15Nested Calculations 7 +65.0000 69.0000Arithmetic Calculations With Constants 5 ‛15 Keys 000 Keystrokes Display Growth factor1000 Storage Register Operations Storing and Recalling Numbers322.5000 520.8750Clearing Data Storage Registers Storage and Recall ArithmeticFor storage arithmetic For recall arithmeticProblems Overflow and Underflow24 l-0 15.0000Memory Stack, Last X, and Data Storage 60.0000 Statistics FunctionsProbability Calculations Random Number Generator 270,725.00005764 3422Accumulating Statistics RegistersRegister Contents 20.00 40.00 60.00 80.00 Kg per hectare Metric tons per Hectare, y20 z 61v 40 z 7.21 60 z 7.78 80 z l Σy2Correcting Accumulated Statistics 20 w 20 z40.00 MeanStandard Deviation Linear Regression 31.62Standard deviation about the mean nitrogen ApplicationLinear Estimation and Correlation Coefficient Statistics Functions Other Applications 70 ´jFixed Decimal Display Display Continuous MemoryDisplay Control Scientific Notation Display Engineering Notation Display234568 234567Round-Off Error Special DisplaysMantissa Display AnnunciatorsError Display Digit Separators12,345.67 12.345.6700Status Low-Power IndicationContinuous Memory Resetting Continuous Memory Page Part ll HP-15C Programming Programming Basics MechanicsCreating a Program Loading a ProgramProgramming Basics ´b a002 003 004 005 006 007 008 Intermediate Program StopsRunning a Program How to Enter Data 300.51 300.51 ´AProgram Memory Radius, r Height, h Base Area Volume Surface Area Totals002 004 005007-44,40 010Or G a Instruction Coding Further InformationProgram Instructions Memory Configuration Keycode 25 second row, fifth keyInitial Memory Configuration 60 ´ m%Program Boundaries ´ m %19 ´ m% 19.0000´bA ´b3 End of memory Unexpected Program StopsAbbreviated Key Sequences User Mode Polynomial Expressions and Horners Method¤ @ y ∕ LOG %Nonprogrammable Functions 001-42,21,12002 003 004 005 006 007 008 009 0000 12,691.0000Problems Program Editing Moving to a Line in Program MemoryInserting Program Lines ExamplesDeleting Program Lines Or use  Single-Step Operations Line Position ÂholdRelease ResultInsertions and Deletions Initializing Calculator StatusPV 1 + i n Interest+ i n 100 270 ´bA D ´4 O0 2* O1 2÷ * ´ ´ l0 l1 ´r * nProgram Branching Controls BranchingConditional Tests TestFlags  n will clear flag number nExample Branching and Looping 010-45,20 013-43,30014 016-44,40Example Flags Formula is002-43 004-42,21,15005-43, 4 006-42,21Go to 250.000048.0000 10,698.3049Looping Conditional BranchingSystem Flags Flags 8 Program Branching and Controls Subroutines Go To Subroutine and ReturnSubroutine Execution ´b.1Subroutine Limits 000 001- ´b9 002- R003- O0 004´ b.4 ´b.5Subroutine Return Nested Subroutines106 Index Register Loop ControlV and % Keys Indirect Program Control With the Index Register Program Loop ControlIndex Register Storage and Recall Index Register and Loop ControlIndirect Branching With Index Register ArithmeticExchanging the X-Register Loop Control With Counters I and e Indirect Flag Control WithIndirect Display Format Control With Nnnnn x x x y y 5 0 0 Start count at zero Count by twos Count up toExamples Register Operations IterationsStoring and Recalling Keystrokes Display 12.3456Storage Register Arithmetic Example Loop Control with eExchanging the X-Register Loop control number in R2 −− 011- 42012-42, 5 013- 2264.8420 0000 50.0000 Example Display Format Control15 O Index Register Contents Indirect Display Control Index Register and Loop Control 118 Part lll HP-15C Advanced Functions Complex Stack and Complex Mode Calculating With Complex NumbersCreating the Complex Stack 120Entering Complex Numbers Deactivating Complex ModeComplex Numbers and the Stack ´ % hold 8.0000 release Z 8 Y 7 X Keys Stack Lift in Complex Mode Manipulating the Real and Imaginary StacksClearing a Complex Number Or other operationContinue with any operation − 4 v Continue with any operation0000 17.0000 144.0000 Entering Complex Numbers with −. The clearing functions −´ %hold release Entering a Real Number Followed by another numberEntering a Pure Imaginary Number ´ Continue with any operationOperations With Complex Numbers Storing and Recalling Complex Numbers´ O L 2 ´¤x N o ∕ @ a + * ÷ y2000 70000428 0491Polar and Rectangular Coordinate Conversions Complex Results from Real Numbers5708 ´ % hold Release1.5708Cos θ + i sin θ = re iθ Polar + ib = ∠ θ + 3.1434 84522981 352.0000 872.00002361 4721For Further Information Calculating With Matrices 138Keystrokes Display Deactivates Complex Mode = A-1BMatrix Dimensions Running11.2887 2496Dimensioning a Matrix Number Rows ColumnsDisplaying Matrix Dimensions Changing Matrix Dimensions´mA Keystrokes l B DisplayStoring and Recalling Matrix Elements Storing and Recalling All Elements in Order⎡ a Checking and Changing Matrix Elements Individually Keystrokes Display Matrix Descriptors Matrix OperationsStoring a Number in All Elements of a Matrix Result Matrix Copying a Matrix One-Matrix OperationsCalculating with Matrices Scalar Operations LB bElements of Result Matrix LA aLB b 2 LA a 2 Arithmetic OperationsKeystrokes Display Subtracts 1 from the elements Matrix Multiplication = AT B Keystrokes Display l a aSolving the Equation AX = B 24 OA 240086 OA 8600274 OB 233 OB 331 OB 120.32 OB 112.96 OB 151.36 OB ´Á Calculating the Residual Week Cabbage kg 186 141 215 Broccoli kg 116Using Matrices in LU Form Calculations With Complex MatricesStoring the Elements of a Complex Matrix Then Z can be represented in the calculator byPressing Transforms Into = ⎢ LA aComplex Transformations Between ZP and Z Inverting a Complex Matrix Multiplying Complex Matrices ´ aKeystrokes lA lB Display Displays descriptor of matrix a ´U lC LC lC lC lC lC lC lC ´USolving the Complex Equation AX = B ZZ −1AX = B 200.0000 170.00000372 13110437 1543Calculating with Matrices Miscellaneous Operations Involving Matrices Using a Matrix Element With Register OperationsUsing Matrix Descriptors in the Index Register Stack Operation for Matrix Calculations Conditional Tests on Matrix DescriptorsCalculating with Matrices Using Matrix Operations in a Program ´m a Summary of Matrix FunctionsKeystrokes Results Calculates residual in result matrix For Further Information 180 UsingFinding the Roots An Equation Finding the Roots of an Equation Clear program memory´b0 001-42,21002 003 005 006 007Finding the Roots of an Equation Desired rootKeystrokes ¥ ´ bA000 001-42,21,11 003 0045000 1 e t Brings another t-valueInto X-register 200 tWhen No Root Is Found 000 001-42,21 002 003 004 005Error Choosing Initial Estimates Label 003 004 005 007 X + 8008 009 6 x + 8Finding the Roots of an Equation Using in a Program Restriction on the Use Memory Requirements194 Using fNumerical Integration 002 003 004 4040 1416 7652Begin subroutine with a label 4401 3825$ ÷ 6054 Accuracy of f ´ i ´ f 8826 7091Using f in a Program 382Memory Requirements Error Conditions Error 0 Improper Mathematics OperationAppendix a 205Error 1 Improper Matrix Operation Error 2 Improper Statistics OperationError 3 Improper Register Number or Matrix Element Error 4 Improper Line Number or Label CallError 5 Subroutine Level Too Deep Error 6 Improper Flag NumberPr Error Power Error Stack Lift Last X Register Digit Entry TerminationStack Lift Appendix BDisabling Operations Enabling OperationsStack Stack Enabled. disabled 53.1301 No stack Lift Neutral OperationsAppendix B Stack Lift and the Last X Register Keys Nnn Clear u ¥Last X Register \ k + H ∆ \ h ÷ À P* q r c ‘ / N z ∕ P\ o jMemory Allocation Memory SpaceAppendix C RegistersAppendix C Memory Allocation M % Function Memory ReallocationMemory Status W 19 ´ m Restrictions on Reallocation´m% 1.0000 Whold 1 64 Program Memory Automatic Program Memory ReallocationMemory Requirements for the Advanced Functions Two-Byte Program InstructionsIf executed TogetherAppendix C Memory Allocation Detailed Look at How WorksAppendix D 220Appendix D a Detailed Look at Accuracy of the Root X4 = 000 1718 006 007 008 009 010-43,30 011 012-43,30 0130681 Interpreting Results´ v B − 45 For 0 x Test for x range Branch for x ≥3x 45x 2 + End subroutine000.0000 Initial estimates1358 Possible rootAppendix D a Detailed Look at ´ b.0 001-42,21,.0 002 003 004 005 Bring x-value into X-register007 008 009 010 013 014 015 016017 018 10 v ´ ‛ 20Error 0000 1250 5626 Finding Several RootsFx = xx a3 = 002 003 004 005 006 0076667 Same initial estimates Second rootStores root for deflation Deflated function valueDeflation for third root Limiting the Estimation Time Specifying a Tolerance For Advanced InformationCounting Iterations Detailed Look at f How f WorksAppendix E 240Accuracy, Uncertainty, and Calculation Time X = π1 0π cos4θ − x sinθ dθ0000 1416 ´ i ´ fKeystrokes Display Return approximation to ´ Clear u HoldKeystrokes ´ i Display ´ f ´ Clear u hold7858 7807Uncertainty and the Display Format Functions values for example Δx = 0.5×10−n ×10m = aδx dxb = ab 0.5×10−n + m x dx Conditions That Could Cause Incorrect Results ∞ xe− xdx 001-42,21 002- 1 003 004 005 Appendix E a Detailed Look at f Appendix E a Detailed Look at f Conditions That Prolong Calculation Time Keys lower limit into Keys upper limit intoApproximation to integral UncertaintyAppendix E a Detailed Look at f Obtaining the Current Approximation to an Integral For Advanced Information Low-Power Indication Installing New BatteriesBatteries BatteriesAppendix F Batteries Verifying Proper Operation Self-Tests 2.C 3.HFunction Summary and Index Complex FunctionsConversions Digit EntryDisplay Control Index Register ControlLogarithmic Exponential Functions Mantissa. Pressing146 MathematicsMatrix Functions To XT Number AlterationTo ZP page164 Percentage ProbabilityStack Manipulation Clear uStatistics StorageTrigonometry Programming Summary and Index 269Programming Summary and Index Subject Index 271Subject Index Subject Index Subject Index Subject Index Subject Index Subject Index Subject Index Subject Index Subject Index Subject Index Subject Index Subject Index Modifications Product Regulatory Environment InformationFederal Communications Commission Notice Canadian Notice Avis CanadienEuropean Union Regulatory Notice Body number is inserted between CE
Related manuals
Manual 63 pages 42.15 Kb