EasyManuals Logo

HP 50G User Manual

HP 50G
887 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #698 background imageLoading...
Page #698 background image
Page 21-51
A complex IF construct like this is called a set of nested IF … THEN … ELSE …
END constructs.
A possible way to evaluate f3(x), based on the nested IF construct shown
above, is to write the program:
« x « IF x<3 THEN x^2 ELSE IF x<5 THEN 1-x ELSE IF
x<3*π THEN SIN(x) ELSE IF x<15 THEN EXP(x) ELSE –2 END
END END END EVAL » »
Store the program in variable @@@f3@@@ and try the following evaluations:
1.5 @@f3@@@ Result: 2.25 (i.e., x
2
)
2.5 @@@f3@@@ Result: 6.25 (i.e., x
2
)
4.2@@@f3@@@ Result: -3.2 (i.e., 1-x)
5.6 @@@f3@@@ Result -0.631266… (i.e., sin(x), with x in radians)
12 @@@f3@@@ Result: 162754.791419 (i.e., exp(x))
23 @@@f3@@@ Result: -2. (i.e., -2)
The CASE construct
The CASE construct can be used to code several possible program flux paths,
as in the case of the nested IF constructs presented earlier. The general format
of this construct is as follows:
CASE
Logical_statement
1
THEN program_statements
1
END
Logical_statement
2
THEN program_statements
2
END
.
.
.
Logical_statement THEN program_statements END
Default_program_statements (optional)
END
When evaluating this construct, the program tests each of the logical_statements
until it finds one that is true. The program executes the corresponding

Table of Contents

Other manuals for HP 50G

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the HP 50G and is the answer not in the manual?

HP 50G Specifications

General IconGeneral
Digits33 digits
Battery typeCR2032
TypeScientific
Form factorPocket
Weight and Dimensions IconWeight and Dimensions
Weight220 g
Dimensions (WxDxH)87 x 184 x 23.5 mm

Related product manuals