Download  Print this page

User Functions For Unit Conversion - HP -28S Manual

Advanced scientific calculator.
Hide thumbs

Advertisement

User Functions for Unit Conversion
If you perform particular unit conversions often, you can write user
functions for those conversions. In this section you'll write user func-
tions O-C and C-O that convert between ounces and grams; since
they're user functions, you can use them in either RPN or algebraic
syntax.
Recall that user functions must fulfill two requirements:
• They must explicitly indicate their arguments .
• They must return exactly one result.
First write O-C.
Begin the program and indicate the argument.
~---------=~~~~~===
0.G
~
x
2:
74.8051948052
1:
'gal'
The right arrow indicates that the following name is a
local variable,
which will exist only within this program.
Define the conversion.
o
x ['] oz ['] [']
9 [']
. 1
CONVERT
I
I
DROP
II
ENTER
I
2:
'gal'
1: «
-1-
x
«
x
'oz' ,
9 ,
CONVERT DROP
" "
mDlIiDIRHlrnHDDDlID
The closing delimiters are added for you.
This program means: take an argument from the stack (in RPN syn-
tax) or from the expression (in algebraic syntax) and call it
x; convert x
from ounces to grams; and drop the gram unit from the stack.
Store the program in a variable O-C.
~----------------------~
['] o.G
G
ISTOI
3:
2:
74.8051948052
1 :
'gal'
mDlIiDIRHlrnHDDDlID
14: Unit Conversion
147
I

Advertisement

Table of Contents

   Also See for HP HP-28S

   Related Manuals for HP HP-28S

Comments to this Manuals

Symbols: 0
Latest comments: