Panasonic Quasar HHC Scientific Calculator (ROM/Capsule)

Panasonic Quasar HHC Scientific Calculator (ROM/Capsule)
•••••••••••••••••••••••••••••••••
•••••••••••••••••••••••••••••••••
•••••••••••••••••••••••••••••••••
..................................
••••••••••••••••••••••••••••••••••••
••••••••••••••••••••••••••••••••••
••••
•••••••••••••••••••••••••••••••••••
•
••••
• •
••••
•
•••
•
••••••••••••
•••••••••••••••
••••••••••••••••••
I• • • • • • • • • • • • • • • •
I• • • • • • • • • • • • • • • •
I• • • • • • • • • • • • • • • •
•••••••••••••••••••••••••••••••••••
• •••••••••••••••
•••••••••••••••••••••••••••••••••••• ••••• •••• •••••••• •••••••••••••••••••••••
::J
-
m
U
-
m
o
u
..,
11­
111_
~
c:
G)
111­
U
(fJ
.~
~
.1)
TABLE OF CONTENTS .~
1)
:i
SECTION 1. INTRODUCTION TO THE
SCIENTIFIC CALCULATOR
j
SCIENTIFIC CALCULATOR FEATURES .......... 1·1
REQUIREMENTS FOR OPERATION ............. 1·2
HOW TO USE THIS MANUAL ................... 1·2
...~
•
.
:. !I
e
~
.
~
~
~
~
(I)
@I
'~
,,
.,
.,,
')
~
.~
@
.~
@
'&
@'
@
~
~
.~
e
e
~
e
'~
~:;
.":\
.,
e
e ~
e
e ~
e
.~
~~ Copyright © 1982 by Matsushita Electric Industrial Co., Ltd.
All Rights Reserved. HHCTM is a Trademark of Matsushita
Electric Industrial Co., Ltd.
,e
c
•
4;­
~
SECTION 2. GETTING STARTED
GETTING SET UP .............................
BECOMING ACQUAINTED WITH THE STACK . , ...
INPUTTING NUMBERS ........................
CONTROLLING THE OUTPUT FORMAT ..........
USING MEMORY .............................
ERRORS AND WARNINGS .....................
2-1
2·1
2·3
2·5
2·6
2-7
SECTION 3. USING THE OPERATION KEYS CONTROL OPERATIONS ....................... 3·1 Memory Control ............................ 3·1 Stack Control .............................. 3·3 OPERATIONAL CONTROL ..................... 3·5 Inputting Numbers ......................... 3-7 ELEMENTARY OPERATIONS .................. 3-7 MATHEMATICAL FUNCTIONS ................ 3-10 Trigometric, Inverse Trigometric, Hyperbolic, Inverse Hyperbolic ....................... 3-10 Power, Logarithm, and Root Functions ....... 3-11 STATISTICAL FUNCTIONS ................... 3-12 PROGRAMMABLE KEYS ..................... 3-13 SECTION 4. PROBLEM·SOLVING EXAMPLES TRIGONOMETRIC FUNCTIONS ................
LOGARITHMIC FUNCTIONS ...................
ENGINEERING FUNCTIONS ...................
FIX and FRAC .............................
Modulo (y mod x) ...........................
Degrees/Radians ...........................
Percentages and ConVersion Factors ..........
Factorials .................................
4-1 4-2 4-3 4·3 4-4 4·5 4-6 4-6 ~
tI
STA TISTICAL FUNCTIONS .................... 4-7 Summations ............................... 4-7 Arithmetic Mean ..................... . .... 4-9 Harmonic Mean ............................ 4-9 Standard Deviation ........................ 4·10 Means and Sums of Squares ................ 4·11 An Investment Problem .................... 4·14 SECTION 5. FLOATING·POINT NUMBERS
AN D ALGORITHMS
FLOATING·POINT NUMBERS AND ALGORITHMS. 5-1
MATHEMATICAL FUNCTIONS ................. 5·3
GENERATION OF RANDOM DEViATES .......... 5·3
Uniform Psedo-random Deviates .............. 5·3
Normal Psedo·random Deviates .......... . .. 5-4
.,
-;;
t.
~
-~
t.
,i)
~
;)
to;
GENERALINFORMATION ..................... 7·1 SyMBOLS ................................... 7·2 FLOATING·POINT ERRORS .................... 7·2 ARITHMETIC FUNCTIONS ..................... 7·3 TRIGONOMETRIC FUNCTIONS ................ 7·3 HYPERBOLIC FUNCTIONS . . ................ 7·5 LOGARITHMS AND EXPONENTIALS ............ 7·6 ROOTS AN D POWERS ........................ 7·7 RANDOM NUMBER GENERATORS ............. 7·8 ADDITIONAL FUNCTIONS ..................... 7·9 MEMORY REGISTER HANDLING .............. 7-10 STACK MANIPULATION AND CONTROL ........ 7·10 CONSTANTS ............................... 7-12 OPERATIONAL CONTROL .................... 7·12 INPUT AND EDITING ......................... 7·13 PROGRAMMING KEYS ....................... 7·13 APPENDiX B. USING PERIPHERALS
THE SCIENTIFIC CALCULATOR
"fd.-•
APPENDIX C. USING THE SCIENTIFIC
CALCULATOR AS A LIBRARY CAPSU
FOR OTHER PROGRAMS
e
APPENDIX D. HHC OVERLAY
~.
e; ;I
.~
e~
.,
e
-~
SECTION 6. MACHINE PARAMETERS
SECTION 7. OPERAnON KEY PARAMETERS APPENDIX A. REFERENCES
...
~
~
".,
~
~
~
~
~
@
@
e·i I
1'1
SECTION 8. ERROR MESSAGES
SECTION 9. HHC AND SCIENTIFIC
CALCULATOR SYMBOLS
,
I ~.,. I~
__ I! . .~
~...,.
I
~:it',
I
l
At
1;.<
ii
;j;
f1 ..~
I ..
#:.1· ~ftl.,
SECTION 1. INTRODUCTION TO
THE SCIENTIFIC CALCULATOR
(t;,!W
ti··
Iw
~!: .. !~'.
The Scientific Calculator capsule satisfies a broad spectrum
of needs
from hand calculations requiring extreme ver­
satility and accuracy to the support, as a function library, for
programs you may write using other HHC capsules.
c,1 •
.... I
­
ei~
ej~
el'!ll
@I!"
I
fill"
fi\" Ii ,~
."
fII.~
~!
flbl
I
@l:tII)
~ltIII)
SCIENTiFIC CALCULATOR FEATURES
The Scientific Calculator is a read-only-memory (ROM) cap­
sule containing 4096 bytes of program for the HHC. It pro­
vides a set of abilities based on an arithmetic architecture
that previously was available only in much larger and more
costly computing systems.
• A complete floating-point arithmetic system for numbers
from 101024 to + 10 1024, It includes the basic operations
add, subtract, multiply, and divide as well as the math­
ematical functions listed below. A minimum of ten deci­
mal digits of accuracy is maintained, with most
calculations achieving twelve digits.
III A complete set of mathematical functions built upon this
floating-point system that provides accurate approxima­
tions and precise error control: sine/cosine/tangent/co­
tangent, arcsine/arccosine/arctangentlarctangent (y/x) ,
logarithm and exponentiation for three bases (2, e, 10),
the hyperbolics sinh/coshl tanh/arctanh, and four ver­
sions of the power function (XY, yx, nth root, and square
as well as I x I, x2 , and 1Ix.
til Optional standard or scientific notation for input and out­
put. Either kind of input is always allowed. However, for
large numbers (Le., I x I> 105), output is always in scientif­
ic notation, which allows entry, display, and calculation of
numbers in the full range of -10 1024 to +10 1024 •
Ii User-selectable memory for saving intermediate results
and frequently used constants.
$
Complete error control, with error messages displayed on
HHC.
1->
@II; @hI
e l
_I~
~I~
II~.
el~
~4.
I
-!
:~
11
~
~1
@
The ability to function as a library for use by other HHC
programs.
'
"'.
1,,1
£,~
I» Innut/oLJtnut ability that allows selection of printer or dis­
recording calculations.
• Continuous memory that allows the retention of results
for later calculations. Memory is lost, however, when you
go out of the calculator to use another HHC application.
II) Three HHC user-definable function keys that allow you to
program sequences of up to 15 keystrokes on each that
will execute when the programmed key is pressed.
This manual will guide both the casual user who needs the
calculator occasionally and the user who needs to define the
preciseness of results in some larger calculations. Full infor­
is given in Sections 6 through 8 on the accuracy of
calculations performed by this capsule.
REQUIREMENTS FOR OPERATION
The capsule requires 96 free bytes of HHC internal RAM. If
the 1/0 menu shows less than this amount, you must delete
a file or detach a peripheral before entering the calculator
program.
~!~
I
e:~
el~
CI
, I
~I~
I
Gi~
I
~I~
~I~
GI~
e;~
e'~
el~
e'
,~
~
II)
@l
~
~
~
\it
...
@
(I:
@
@
HOW TO USE THIS MANUAL
~
Read Section 2 to become familiar with the keyboard and the
stack concept. Section 3 gives you an explanation of how
each key functions. Later you will want to examine Section
4, which leads you through examples of varying complexity.
Section 5 explains the algorithms used in the mathematical
and statistical areas; they are designed to provide accurate
resu Its over the large argument domains.
e
e
e
Finally, Sections 6 through 8 give complete specification on
the boundaries and parameters associated with the Scientif­
ic Calculator's floating-point number system, argument do­
mains and result ranges for' each function, and error
messages that are displayed when appropriate.
~
e'
e
~
.,
fl5I
..,
III)
'"
")
~
,~
STARTED
SECTION 2$ GETTING SET UP
To get started, turn the HHC OFF, then plug the Scientific
Calculator capsule into the back of the HHC, but do not yet
put the keyboard overlay in place. Press ON and then press
the CLEAR key once or twice. The primary programs menu
will be displayed; press the number of SCIENTIFIC CAL­
CULATOR. Notice the momentary display confirming that
you have selected the desired capsule. Now you can put the
keyboard overlay in place and use the calculator.
ACQUAINTED
The stack is baSic to the Scientific Calculator. It is a section
of memory that can contain up to ten standard or floating­
pOint numbers. The first number (top of the stack) is dis­
played at all appropriate times. The STACK is under user
control through the operation keys.
Reverse Polish Notation is used to enter arguments for cal­
culations. This concise "programming" notation is used in
many computers and calculators, particularly those that are
stack-oriented.
As an example, use your calculator to follow the calculation
of adding 4 to 6. A standard statement would be 6 + 4
10. However, using the Scientific Calculator and Reverse
POlish Notation, you press
6
ENTER
4
ADD; 10 is displayed as the an­
swer.
?
(':
?
f:
..",
e
"¢
t:;
'?>
C~
?
c;
-':£;
....~
'I!r
In this example, keys affect the stack as follows (assuming
that only stack levels 1 and 2 have numbers in them) .
Key in
Stack Level
Value Display 6 ENTER
1:
6
8
4ADD
i.
I •
4
2:
6
6 is displayed
ADD is pressed,
the addition
occurs yielding the
next condition)
~
iii
'<'J<
~,
i.?
",
THE STACK
~
?1
.~
f.;.
~
10
1:
2:
10
(note that level 2
is now empty.)
Now press DROP to remove the one remaining stack entry
and trv a more complex example.
Key in
Stack
1 PUSH
.6 PUSH
SHIFT
1:
1:
2:
1:
.6
1
..
I
c;..~
~
~
e
~
e;
~
.
c,...
Ct"
~
Calculate the square root of 1 - x2 . Let x be 0.6. Note that
PUSH and ENTER are the same key. The term PUSH is the
more "stack-oriented", but we use both interchangeably.
i
.t; . il
e ~
e
e !.)
e ...,
.~
~
4I!IJ
fI
II)
~
\II)
~
ill),
'"
~
2:
.36
1
IP
~
@'.
II!')
SUB
1:
.64
@>
.,
V-
1:
.8
@'
~
@
lII)
X2
In the Scientific Calculator, all one-operand operations
(keys such as X2) use the first stack entry (the top) as the
argument, and replace that entry with the result. Thus, to
both save and use an argument, you should first store it in
memory or duplicate it (DUP) on the stack so that it is on both
level 1 and level 2. Then you can perform the operation and
still retain the original number.
Two-operand operations like addition (ADD) combine the
two numbers nearest the top of the stack, placing the result
at level 1, eliminating level 2 and shifting levels 3,4, ... n up
one level each.
NOTE: Keying in a number does not put it on the stack
Sometimes you may want to view the current contents of the
stack. If you are not in the middle of an operation, you may
do so by pressing the DISP key. The first use of this key
results in a display of the quantity of items on the stack.
HEIGHT=5
After this, each time you press any key except CLEAR or
CANCEL, the next level of the stack will be displayed, start­
ing with level 1.
1: 2.56E9
After the fast item is shown, the calculator returns to key­
board input mode, displaying the value on the top of the
stack. To leave the display mode while it is cycling , press
CANCEL; this will return you to keyboard mode so that you
can continue normal operations.
To try out this display feature, press DISP now. Then press
CANCEL to return to keyboard mode and DROP the .8 put
in level 1 at the end of the example above. Work your way
through this example, using DISP to view the stack after
each step. You should be able to verify the stack level and
contents as they are shown. Remember to press CANCEL
to return to keyboard mode.
~
~
e'')
e
?
e""
")
eo
e
e
e
e
(;
The number displayed on the LCD (liquid crystal display) is
usually the number on the top of the stack. When you key
in another number, it will become the new top entry as soon
as you press PUSH. The number you enter may contain as
many as seven components.
Keys
."Al
~~
~~
"';~
,
~4',
~~
INPUTTING NUMBERS
")
'.&.
automatically. For tv-va-operand operations, if the first
number is keyed in, it must be PUSHed onto the stack.
If the first number is the result of a preceding operation
or if it has been recalled from memory, it will be on the
top of the stack already and need not be PUSHed.
There are also no-operand keys; for example, generation of
a random number adds a result to the top of the stack. There
are control keys that give precise control of the stack. All
this, as well as what happens in case of an out-of-bounds
result, is discussed in detail in Section 3 and in Section 7.
.~
1. a sign
2. a string of integers
3. a decimal point 4, a fractional part 5. an exponent symbol
6. a sign for the exponent
7. an integer for the
exponent
?:'{
Example
+/
0,1, ... 9
12
O,i
34
E
ENT EXP
+/­
0,1, ... ,9
56
ti
This example yields the number 12.34 x 10 - 56; the cal­
culator stores this internally as 1.234 x 10- 55 . Examples
of acceptable numeric entries are:
if.;
f;
~
t;.
'
Integers such as:
0
1
650
-442
+17
Values with exponents:
6E20
4.12E-1
1.0009E 6
4E+16
(=6 x 1020 )
(=4.12 x 10- 1
.412)
( -1.0009 x 10- 6 )
( 4 x 1016 )
The overall sign and the exponent's sign may be omitted with
positive or zero values. You should use the
key to enter
a negative sign (do not use the SUB key). The + key can be
used for correcting improper minus signs during input and for
indicating sign on a printed output.
The magnitude of the mantissa (e.g., 12.34 above) need not
contain all three components, but must include at least one
numeric digit. For example, 12, 12., and 012.0 all yield the
same result. Although thirteen significant digits of accuracy
are retained, more digits may be entered,
exponent (e.g., E 56 above) may be omitted for num­
bers that can be represented by no more than twenty-six
characters without an exponent. If the ENT EXP key is used,
then at least one digit must appear for the exponent's inte­
geL This integer cannot contain more than four digits; within
this constraint, leading zeros are allowed.
The number input is limited to twenty-six characters and
cannot exceed the range of numbers the calculator can
store.
?II
.,
.~
~
(;
~
G
Cf
0.0
.00096
.2
+643.33333333333
12.00
'.;1
e
<I,
Decimal values:
••
e
e
e
e
@:
~'
...
•
~
.~
':;)
,.~
.,
,~
.,.,
~
till;
fl
@~
II!!
,Ill!!
@
~
~..
"!I
@.
~
.,.
§l)
e,.
II')
e
?
?
")
Before the PUSH key is pressed, the number may be com­
pletely reedited. Use the left- and right-arrow keys to place
the cursor for editing; there is no space bar. After a number
has been entered with the PUSH key, it cannot be changed .
CONTROLUNG THE OUTPUT FORMAT
The SCI and DIG keys control calculator output format (the
input format is not affected). Their default values are fixed­
point notation (SCI key toggled off) and display of 10 signifi­
cant digits (DIG).
To have your results presented in scientific notation, press
the SCI key once to turn it on; the DELETE blip shows on
the display to indicate that SCI is active. Key in the following
demonstration .
Key in
Display
123456 PUSH
SCI DUP
123458 1.23458E5 To return to standard notation, press SCI again to turn it off;
the DELETE blip disappears:
Key in
Display
SCI
123458
DUP
The DIG key controls the number of significant digits
presented on the display. The default value for this function
is 10 digits; however,the maximum value of 12 digits allows
you to take full advantage of the Scientific Calculator's 13­
digit arithmetic. Calculations use all the digits entered (up to
13), and results will be rounded to the number of significant
digits you have chosen. Continuing with the example above:
Key in
Display
DIG
3 ENTER
DUP
295 ADD
TYPE NUMBER (1-12):
TYPE NUMBER (1-12): 3
123458
"'»
?
e'
'),
C:
':'~
. ~'~
~
.':,t
~'"
~
k
123000
124000 (123456 + 295 ;: 123751,
which is rounded to
3 significant digits.)
To verify that all digits entered have been used in the calcula­
tion and put onto the stack, reset DIG to a larger number and
then DUP to see the top of the stack.
~.
It·
?!'i
fI
ft
Key in
Display
DIG 7 ENTER
DUP
124000
123751 (= 123456
"
w
.~
.~
+ 295)
The DIG setting will remain until changed deliberately or until
the CLEAR key is pressed, which causes the setting to revert
to default. Turning the calculator off does not affect the set­
ting.
USING MEMORY
Every number used in a calculation is put on the stack auto­
matically, and the stack must emptied when it becomes full.
However, numbers must be specifically stored in one of the
12 memory locations and they stay there until specifically
cleared with either ClM, which clears all memory locations,
or CLS, which clears a specified memory storage location.
Contents of memory can be recalled at any time either by
you or by a program that you have entered in the f1 , f2, and
f3, user-definable function keys.
Data stored in memory is not affected by turning off the HHC
or by pressing CLEAR once. However, pressing CLEAR
twice to access the HHC primary menu and other HHC
applications will destroy the contents of all 12 memory loca­
tions.
To familiarize yourself with the storage function, run through
the following example. Either key in a new number to store
or use the number on top of the stack that is displayed.
Key in
Display
4
4
~
3.141592854
12.58837081
TYPE NUMBER (1-12):
TYPE NUMBER (1-12):8
12.58837081
MUl
SHIFT STO
6
ENTER
.~
e;,.
e
(f
~
.,
~
tf
e
.~
e
~
f!;
~
~
~
,.
~
•
...
~
"
~~.
fA)
....
fIJi
~
I)
~
IIiJI
@ ...
@ II')
~.
'!It
~
~
e'
~~
e:
''''J,
e
~
e:
~
e "')
?
~
~
~
.....~
Display
6
TYPE NUMBER (1-12) 12.58837081 ~4'.
ENTER
Attempting calculations with invalid parameters will result in
error messages. These can occur in the following two situa­
tions.
/IIegal operation - if you violate the constraints of the float­
ing-point system in your calculations or if you use math­
ematical functions with incorrect arguments. For example,
raising 2 to the power 10000 is prohibited, because 10000
is too large an argument, and the result exceeds the max­
imum machine-representable number (Section 6). Similarly,
division by zero is not toleiated.
Accuracy Bound - jf an argument presented to a routine
results in a function value considered to be too inaccurate.
For example, sine routine arguments should be less than
102942 radians in absolute value. This is because n times
~ is used to reduce the argument; if the argument is large,
it is nearly n times ~ (being identical to it to a number of
significant digits). Then, in subtraction, these identical digits
are lost. The sine approximation is tailored for arguments in
the (OJ~/2) range, so that the reduced argument will be less
significant than was the original argument by too large an
amount; the result cannot be as accurate as desired, since
the argument was slightly altered during reduction. The
bounds on the argument domains presented in Section 7
were chosen so that the floating-point arithmetic system
could be fully exploited by the algorithms used. Users are
protected from results which may be "less than accurate"
because of arguments that are too large to be accurately
reduced.
In both overflow and accuracy bound,
•
an "ERROR n" message is displayed. Tables 7 and 8
discuss the meanings for the various values of n. Use the
CANCEL key to remove the message from the LCD;
•
the same number of inputs is dropped from the stack as
would be appropriate if the operation succeeded;
II
the resultant top stack entry (an invalid-floating point
number) is automatically dropped; and
•
other stack entries and user memory are unchanged.
?
To verify entry, recall the number from storage:
Key in
ERRORS AND WARNINGS
•
"
~.
,4\
"'"
II'
There are other situations in which warning messages are
given. For example, an attempt to execute an instruction that
would underflow the stack causes a beep; neither the display
nor the stack is changed. When the maximum stack height
of 10 is reached, the HEIGHT WARNING message Is dis­
2·7
~
~
'~
played. No more stack entries will be accepted. You can use
the DISP key to display stack entries and can diminish the
stack by using a combination of the ROLL and DROP keys.
You can also press CLEAR once; however, this will cause
the DIG and SCI keys to revert to their default values.
fJ
t;, e
.~
~
~
~
~
Cf Cjl ~,
••
•
e,
.~
e
e
~
.~
e:
~
~"
~
f"
I!!I
..'",
I!I
.
fIJ
"S
@l ~
@:
II)
@:
,~
f!' ~
III!lI ~
e.'
e
e
e
(;;
~:
~
2·11
III
NOTE: When two functions are assigned to one key,
the upper function printed on the keyboard overlay is
accessed by pressing and releasing the SHIFT key
before using the function key. If you change your mind
after pressing SHIFT, press SHIFT again to cancel it.
CAUTION: All the HHC keys are still functional when
you are using the Scientific Calculator. Therefore, you
must be careful not to press the HHC 2nd SFT key.
If it is used with an HHC alphabetic key that has a
second shift value, the calculator will BEEP; if used
with an alphabetic key without a second shift value,
the calculator will treat the keystroke as CANCEL.
CONTROL OPERATIONS
Memory Controi
'~
""AI
'.;;\
~~
~...,.
..
The discussion is organized by category: control operations,
elementary operations, mathematical functions, statistical
functions, and programmable keys. The more complex func~
tions are explained with problem-solving examples in Sec­
tion IV.
"':;;l
~
lIP'" This section discusses the operation of each key you may
use while operating the Scientific Calculator. Simple exam~
pies are given that include key strokes, stack contents, and
the HHC display for each step where this information will be
helpful. The HHC will BEEP when you enter an illegal keys~
troke .
~
.?
e
SECTION 3. USING THE
OPERATION KEYS
.'"
1t',
Memory contents are not affected by turning the HHC off or
by pressing the CLEAR key once. However, pressing
CLEAR twice to return to the HHC primary menu will destroy
the contents of locations 1 through 12.
411 STO (Store Memory), This key allows you to store any
valid HHC number (one you enter for this purpose or one
already on the top of the stack) in a storage location 1
through i 2. The iocation number is entered after the prompt
asking for one appears on the display. Location 12 is used
to store the seed for Xu and Xn in statistical calculations; it
is the only location that can have its contents altered by the
capsule without an explicit request from the user.
'1. 'i
~
'::1
•'"
Key in
Display
~;
' -.
1234
SHIFT
STO
1234
t,,:
t;;;
~
9
ENTER
TYPE NUMBER (1-12):
TYPE NUMBER (1-12):9
1234
The number entered into memory is also put on the top of
the stack.
s REC (Recall Memory). Use this key to recall to the display
the contents of any storage location 1 through 12; the num­
ber recalled is also put on the top of the stack.
Display
REC
TYPE NUMBER (1-12):
TYPE NUMBER (1-12):8
1234
ENTER
If;;:
(.:'
t;:,
~
e,
~:
f!;
Key in
9
t;
~
When a number has been recalled and is shown on the
display, it can be used in 1- and 2-operand calculations
because it has been put on the top of the stack automatically,
pushing the preceding entry down to level 2.
ClM (Clear Memory to zero). Pressing this key clears all
memory storage locations to zero.
ClS (Clear Storage location n). The prompt asks for the
number of the memory storage location to clear.
ENTER
:i
~
~
II),
~.:
~
~,
."
~~
')
@:
tI)
I',)
">
")
':')
'.::II
Display
":':I!
(assume that the contents of 9 are 68)
24
24
9
~
~
~
TYPE NUMBER (1-12):
TYPE NUMBER (1-12):8
24
e:
e
e
Key in
Display
REC
9
ENTER
TYPE NUMBER (1-12) =
TYPE NUMBER (1-12):8
~
~
operate on the contents of a specified memory location 1
through 12. The number on the top of the stack is used; this
can be the result of the preceding operation or a number that
have iust keyed in.
M-
•
•
,
.,
ill
111)
e M -, M+ (Memory subtract and add). These two keys
Key in
~
.
..'.. .,
~,
@
III
~
To verify the subtraction, you can recall from memory:
ilL! ( = 68 - 24) The number keyed
in is subtracted from the contents
of the memory location specified.
Stack Control
Every number that you key in must be pushed onto the
of the stack by you or by an operation key. A
message will be displayed when the stack is
no new numbers will be accepted. If you receive this warning
message, you can store your last entry in a memory storage
location, then use DROP or a combination of ROll and
DROP to remove numbers from the stack to continue oper­
ation. You can also press CLEAR once.
CAUTION: If you press the CLEAR key for any rea­
son, stack contents are destroyed (and the SCI and
DIG keys are turned off, returning to their default val­
ues).
., PUSH. The ENTER,PUSH,DUP key is used to put your
keyboard entry on the top of the stack. Used several times
in succession, it will put the same entry on several levels.
• DROP,C/E. This key is used to delete the entry on the top
of stack and display the next level as the new top level.
the stack is empty, the cursor is displayed. You must be in
keyboard mode to do this; the key will not operate while you
are cycling through the stack display (press CANCEL to
abort the DISP cycle).
Key in
Stack
?
1: 8.3E2
?I.
2: 4.683E
~
4: 6
~
:?­
9
3: 3.1415
DROP
1: 4.683E
2: 3.1415
9
3: 6
,
The DROP,C/E key is also used to CLEAR ENTRY from the
,~
'V")
~~
display before it has been PUSHed onto the stack. In this
use, the entry on top of the stack is not dropped.
• SWAP. Use this key to exchange the top two entries on
the stack. Neither number is destroyed.
Key in
SWAP
Stack
Display
1: 789
2:476
789
1: 476
2: 789
478
ROLL. This key will remove the number from the specified
stack level and push it onto the top of the stack. The prompt
requests the number of the stack level containing the num­
ber you want moved.
It
Key in
Stack
Display
1: 9
9
2: 8
3:7
TYPE NUMBER
ROLL <1-3) :
TYPE NUMBER
3
(1-3):3
ENTER
1: 7
7
2:9
3:8
Note that the number 7 is no longer in its original relative
position in the stack.
PICK. This I<ey operates like ROLL except that the num­
ber at the specified stack level is left in its original place as
well as being placed on the top of the stack. Press PICK.
After the prompt, key in the level number and press ENTER.
The duplicate is pushed onto the top of the stack; the original
retains its initial relative position in the stack sequence, but
is one level lower.
It
DISP. Use this key to see how many entries there are on
the stack and what their values are. The first time you press
the key, the display will tell you the height of the stack
for
example
II\lI
HEIGHT::: 1I
~.
¥
t;.;
~
~.
~
f;
~
e ;,
ti,
~
~
G
;,
•
~.
~
t;
~
f;.
~
e
~
e.
e
~
!;
~
~
~
~
~
Il)
~
~
~.
'J; ~
~
~
~
~
~
~
~
e
l1li;,
~
~
1 : 3.58ElI
Press again to see level 2, and so on. When all levels have
been displayed, the calculator returns to keyboard input
mode, displaying the value on the top of the stack. To stop
the cycle at any paint and return to keyboard input mode,
press CANCEL.
DISP will not show a number that has not been PUSHed.
OPERATIONAL CONTROL
II ENTER. The ENTER,PUSH,DUP key is used to complete
the entering of data requested by a prompt on the display,
such as for a number of digits or memory storage number.
• CANCEL. Use this key to cancel operations that ask for
a response (such as REC, STO, and DIG) if you decide not
to activate the operation, to return to input mode when the
DISP key is active, and to cancel an error message so that
you can continue operation.
DIG. This key is used to control the number of significant
digits in the numbers displayed. The key is effective until
pressed again and the setting is changed. Pressing CLEAR
for any reason, however, will release the setting and will
return to the default value of ten digits. Although the number
is displayed rounded to the specified number of digits. it is
in memory as entered and can be recalled in its original form
by respecifying a larger number of digits.
Ell
e ")
Key in
e
DIG TYPE NUMBER
~.
2
TYPE NUMBER
?
?
ENTER
123
PUSH
¢
":.'l
456
c;
~+'
e
~
e
e'
~
.~
e .,.
e
e
~+
"4'
#
If you press again, the first level of the stack will be displayed.
Display
Stack
(1-12):
(1-12):2
ADD
123
123
1:123
458
580 (note the
effect of roundin the display)
1:579
Up to here all calculations have been displayed rounded to
2 significant digits. Now, if you specify more digits you can
obtain the result of the calculation unrounded unless your
was more than 12 digits.
A~
:-:1.1;
Key in
Stack
Display
TYPE NUMBER DIG
4
~
~
Itt
~
.;
(1-12': f!.
TYPE NUMBER t;,
~
~
~
(1-12):4 ENTER
DISP
1 :579
579
(
123
+
456)
Note that although a large number of digits may be input and
thirteen are retained, twelve digits of accuracy at most will
be displayed.
SCI. This key operates as an on-off switch; the ON mode
is disabled when CLEAR is pressed; default value is stan­
dard, fixed- point notation. The SCI key ON will cause all
numbers to be displayed in scientific notation, the number
of digits being controlled by the DIG key (default is ten digits).
The DELETE blip is displayed when the SCI key is active.
Ii
DEG/RAD.ln the Scientific Calculator, trigonometricfunc­
lions can be used with angles specified in either decimal
degrees or radians. The DEG/RAD key is a toggle switch that
must be set to match the mode of your inputs; its default
value is radian mode. Press the key to cause the mode (but
not the data currently on the display) to change to degree
mode. Press the key again to revert to radian mode. The
current mode is indicated by the INSERT blip - blip showing
means degrees, blip not showing means radians.
III
The DEG/RAD key does not convert previous calculations.
You can use the following conversions to do this. If it is a
frequent calculation, program one of the f1 ,f2,f3 keys to do
it for you.
n degrees on stack: enter
(n degrees x 1T/180
radians equivalent)
1T
DIV
~
.,
(;,
.
~
(jr
~
e.
~
~
,!.
f!;
!)
.,.,
~
5
~.
.......,
•
~;
~. 'l @-
±. Use this key to enter a sign for a number or an
exponent. This is not a function key and will not add or
subtract.
1111
• 0,1, ... ,9. The numeral keys are used to enter the numbers
for your calculations or in response to prompts from the
display. Press the ENTER, PUSH,DUP key to complete the
entry. To cancel an entry rather than entering it, press
DROP,C/E to clear argument entries and press CANCEL to
clear the response to a prompt for storage location, number
of digits, etc.
• .(Declmal). This key is used to enter the decimal ooint in
numbers.
• ENT EXP (Enter Exponent). Use this key to enter an
exponent with your number. For example. 123E 5 PUSH
stores 1.23 x 10- 3 (.00123 in standard notation) on the top
of the stack; pressing the ENT EXP key after the 3 key
causes "E" to be displayed.
+-,~. Use these arrow keys to space the cursor forward
and backward to change a number before you have PUSHed
or ENTERed it. Note, however, that you cannot correct an
error in the f1, f2, f3 keys this way; you must start over.
II
@t.
~
~
~
4!.
I;)
ELEMENTARY OPERATIONS
~
•
~
"
~.
e .,
e ?
11" and 'Y. Keying in either of these constants automatically
pushes your previous entry to stack level two. Use the proce­
dure below to find the circumference of a circle with a radius
of 2.6 feet (or meters).
= 3.14159265359)
('Y = 0.5772156649)
(11"
?
Key in
2
1T
?
e
e
?
~~
n radians on stack: enter
180
e
e
180 DIV
11"
~
Inputting Numbers
MULT
e
c
~
e .
radians x i 80i1T == degrees equivalent)
Angles in degrees, minutes, seconds must be converted to
decimal format before entry. Section 4 shows you how to
program the calculator to do this.
·.~It·'
MULT
2.6
.~,j!>
~...,
i
~i
~I
II ;,. .
Display
2
3.14159285359
8.28318530718
2.8
18.33828 ft
ADD, SUB, MULT, DIV. These functions require two argu­
ments on the stack. Pressing the operation key automatically
pushes the second argument onto the stack if it has just been
keyed in; then it performs the operation, deleting both argu­
ments and putting the result on the top of the stack.
(I)
•c+'
::I.A
~;
,$' (Ifll
3·7
.e, .,
Key in
Stack
Display
360 PUSH
1:360
1:720
380
720
2
It;
Any numbers within the HHC range can be used for these
two-number operations. However, because the HHC trun­
cates at the thirteenth digit, adding or subtracting numbers
whose exponents differ by more than 12 will result in display
of an answer identical, except possibly in sign, to the input
number that is the larger in magnitude. As an example,
consider trying to add 1.E13 and 2.
10000000000000
+ 2
10000000000002
t_Truncation at the thirteenth digit.
If an out-of-bounds result is produced, an error message is
given, and the result is automatically dropped. As an exam­
ple, enter
9E1023
PUSH
DUP
Any number less than 10- 1024 is considered to be 0 and
could result in a zero-divide error.
., 1/X, X2, These two functions operate on the number on
the top of the stack or a number just keyed in. 1/X will give
the reciprocal of any number in the HHC maximum range;
X2 will give the square of any number no larger than the
square root of the plus-or-minus maximum HHC number
(see Section 6).
Display
Key in
e;
•
~
';.
"
~
~, ~
Cf
.,
ill
G: ;;,
25
25
1/x
SHIFT
X2
825
@)
FRAC. Used to obtain the fractional part of the number
on the top of the stack and to drop the integer. Answers will
be in the range> 1 to < + 1. The fraction is placed on the
top of the stack with the original number being destroyed.
Display
123.456
SHIFT
FRAC
123.458
123.456
SHIFT
FRAC
-123.456
4.S8E-l
or • a58
-4.S8E-1
t 458
or
• FIX. The opposite of FRAC; the fractional part of the
number is dropped and the integer is placed on top of the
stack and on the display.
-123.456
FIX
-123.458
-123
e: NOTE: Rounding can seriously affect FIX and FRAC,
as shown by the following example. Assume that DIG
has been set to 3.
J)
~ .t)
(II! '~
~
~ Key in
Stack
Display
FIX
9.999
9
10
8
Key in
Stack
Display
~ ~
FRAC
9.999
.999
10
.888
e~
or worse,
9.9995
.9995
10
@i .,
~
~' ~
~
@>
"'11
.~
~
e~
if: ~
if: ,~
e; ~
~.
8 I X I [ABS(X)]. This key will change the number on the top
of the stack to its absolute value.
~~
-12.4
SHIFT
-12.4
~~
IXI
12.4
~;:.
"'~,
Iii" 1
Display
,,-~
Iii
FRAC
Key in
.~~
!Ii 3·8 Key in
e ::.
e ,
Display
25
.04
Display
Display
~
~.
25
Key in
Key in
e
~ fIj
MULT
The display will show the message ERROR 2 (floating-point
overflow). Press CANCEL to cancel the error message, then
press DISP. Note that none of the above calculation is
present on the stack.
Key in
f.:,
f.;,
"~4'
$
CHS. This key changes the sign of the number being
displayed (mantissa only, exponent is not affected). If the
number being changed is already on the top of the stack, it
will be replaced with the changed value. If the number has
not yet been PUSHed onto the stack, pressing CHS will
.A
".~
3·9
~.'V
cause stack contents to be pushed down one level, and the
changed number to be put on top.
Key in
CHS
CHS
Stack
Display
-2.5E8
2.5ES
25E-8
-2.5EB
2.5E8
,­
t;, -
e ,.
re ,..
,. f; ,.
(f
MATHEMATICAL FUNCTIONS
~
.•
Note that for functions using two stacked arguments, x
denotes the item on top of the stack at level 1 and y denotes
the item at stack level 2.
e
e
The Scientific Calculator is initialized to expect angles to be
entered in radians. If you are using degrees, press the DEG/
RAD key to set degree mode. The INSERT blip will show
when degrees mode is active.
• SIN, COS, TAN, COT; ASIN, ACOS, ATAN, ACOT; SINH,
COSH, TANH, ATANH, and ATAN2 automatically control
over- and underflow. Examples are given in Section 4; de­
tailed parameter information is contained in Sections 6 and
7.
Except for the ATAN2 function, all of these functions operate
on the value on the top of the stack. ATAN2, the two-argu­
ment arctangent computes [tan- j (y/x)J, x being the value at
stack level 1 and y the value at stack level 2.
• Find the angle whose tangent is 36.75:
II
Key in
Display
36.75
SHIFT
ATAN
38.75
e ~
e '!>
')
~
@
!;
@
~
~
~
@
@
'"
@Ii,
~
~
@:
8')
~
~
@
@.
~
e. ~
e
e ~
e ...~ C: '41
"?,
=
36.4
~~,
t;, -:;"
Key in
Display
36.4 PUSH
14.57
ATAN2
38.4
c: ""*
~, ':'".4:\
~4
1.18005
DEG/RAD
(INSERT blip goes on for degree
mode) 38.75
.801254
Most of these keys operate on the value at the top of the
stack. However, several require two arguments. For the one­
operand functions, just key in a value, then press the function
key. The result of the calculation will be displayed.
XV, yx. These keys allow you to raise any number to any
power, keeping within the Scientific Calculator range. Y is
the value at stack level 2 and X is the value at stack level 1.
Ii
Key in
Stack
Key in
Stack
3
1:
3
3
1:
1:
2
2
1: 2
2: 3
yx
1: 9
PUSH
2
2: 3
SHIFT
XY
$I)
,,,),
Display
Power, logarithm, and Root Functions
~
~
1 .54358-radians
Two-argument arctangent: x "" 14.57; y
~
Key in
36.75
COS
,.
(f ,.
Trigometric, Inverse Trigometric, Hyperbolic,
Inverse Hyperbolic
., Cosine of 36.75 degrees:
1: 8
4"
3
(3 2)
(23 )
• 2'1., ex, 10X. These keys allow you to raise these three
constants to any power, keeping within the Scientific Cal­
culator range. x is the value on the top of the stack. The value
of e is 2.71828182846. Key in the value of x, then press one
of the power keys. The result appears on the display and is automatically put onto the top of the stack. • Log 2 • Loge' Log 1o ' These keys compute the log of x, the
value on the top of the stack, to base 2, base e
(2.71828182846), and base 10, respectively. x, the value on
the top of the stack, is replaced by the result of the operation.
0)
•
Gives the square root of the value on the top of the
stack.
111\
V. This key will give you the nth root of the value on
top of the stack. When you press this key (SHIFT first), the
display will ask you for the value of n -- an integer from 1
to 50. Key in the number and press ENTER.
"!';
3-10 PUSH
3·11
Key
in
Stack
Display
10.3
10,3
SHIFT
.y-­
TYPE NUMBER
3 ENTER
(1-50l:
2.178
1: 2.176
(the cube root of
10.3)
It;.
'.w
,f;,
w
~
t.I:
.,.,
•
•
t:. • c. .,
STATISTICAL FUNCTIONS II
w
w
Xn, Xu' These keys are used to generate pseudo-random
normal or uniform deviates, respectively. Storage location 12
is used to store the seed for calculations. If no seed is placed
there, a specific seed will be chosen by the generator. For
a given seed, the pseudo-random numbers are always gen­
erated in the same sequence; therefore, if you restart with
the same seed, you can duplicate your calculations. The use
of these keys is demonstrated in Section 4 in An Investment
Problem; parameters are given in Section 7. A detailed ex­
planation of the algorithms used is given in Section 5.
The uniform deviate, Xu' has a uniform built·in distribution
preference and can generally be represented by a straight
line (the range of results is from zero to one). You are as
likely to get .001 as a result as .799; this is analogous to
picking numbers out of a hat, replacing each number after
picking it. More correctly, the deviate is distributed uniformly
on the (0,1) line.
I
I
I
I
I
!
u
The normal deviate,
has a built·in distribution that can be
represented by a normal curve (the "bell" curve).
I
e· .,
e
~
~
!)
~.
~
~
. .,
..
8.)
~.
~
~
",
~
....
~:
@'
~
e
~
@'
J"),
e·
?
Ii!'
""
e
e
e
II!:
e
~
e
e
I
I
~
I
I
I
I
";'II
!
Normal distributions occur very often in real-life situations:
IQ-.-most people have an 10 between 85 and 115; far
fewer have an 10 below 60 or above 140.
dice-throwing two dice, you are more
than 2 or 12.
PROGRAMMABLE KEYS
These are the three user-definable keys (f1 ,f2,f3) described
in the HHC user manual, INSTRUCTIONS FOR USE. You
can define each key to represent a sequence of up to 15
keystrokes that will be executed when you press the defined
key. For instance, you can program them to function as a
constant recurring value or to execute a series of calcula­
tions.
To enter a program, press HELP, then the desired program
key (e.g., f1). Enter the required keystrokes, then finish the
programming by pressing the same f key again. (When 15
keystrokes are entered, the program terminates automat­
ically.) Mistakes can not be edited; you must cancel the
program by pressing the f key and then starting the proce­
dure again from the beginning.
The use of these keys is demonstrated extensively in Sec­
tion 4. Section 9 shows the correlation between the Scientific
Calculator keyboard and the HHC characters that appear on
the display when you are programming one of these keys.
";;!,
~
':",;1\
';l;
~
~
,4'
C'<!,.
~.,;.
u
In a normal distribution your result is more likely to be t
than u (because the curve is higher at t ), whereas in
a uniform distribution t and u are equally probable.
s;
,~,
,~ 3-12
to throw 7
3·13
v
V
to,
~
,.
~
e,. .
..
~
(f. .,
e .­
e ;;"
It :>
e
'!)
~
@ '"
~
~ ~
f'
.,
~
4! .~
@ lIP)
~
#).
t!!'
",
SECTION 4. PROBLEM ..SOLVING
EXAMPLES
Now that we have seen the operation of the individual keys,
we can begin combining the various elements available in
the Scientific Calculator to solve problems .
TRIGONOMETRIC FUNCTIONS
The following trigonometric exampies assume that the stack
is initially empty and that the SCI (standard, fixed-point nota­
tion), DIG (10 digits), and DEG/RAD (radians) keys are at
their default values.
"
Calculate the sine of 0.5 radians.
1. Select the desired number of output digits, say 9:
Key in
Stack
Display
DIG
TYPE NUMBER
9
TYPE NUMBER
(1-12):
ENTER (1-12):9
2. Enter 0.5 and execute SIN
0.5
1: .5
I) •
SIN
1 :.479425539
.478425538
5 (in this case,
PUSH is optional)
,II)
e?
e
e .,
"!)
e: ?
J,?>
~
"?
e
~
~1t
~.
?
~.
?
;~$
s;. ~
:..:>
7i~
If you want to enter degree arguments, press the DEG/RAD
key before you start entering them. Thus, the calculator
assumes that arguments for the trigonometric functions are
being given in degrees, and results of inverse trigonometric
functions will be presented in degrees. Pressing the key
again will cause the calculator to revert to radians mode, but
will not convert data already entered.
" Calculate the arctangent of 1 .01 1.0. This operation
places the result in the proper quadrant
Key in
Stack
1 PUSH
1: 1
DUP
1: 1
2: 1
Display 1
1
Ci"
4·1
~
~
CHS
ATAN2
-1
~
1
.~
1: 2.35619449
2.35819449
loge(25)/log e(5)
Stack
Display
25
1: 25
25
LOGe
1: 1n(25)
3.218875825
5
1: 5
2: 1n(25)
5
LOGe
DIV
1:
2:
3:
4:
1: 1n(5)
2: 1n(25)
1.809437912
1: 2
2
[= log5(25)]
result intermediate result intermediate result log5(25) and we wished to multiply the ·result by log5(25). PICK 4
ENTER would result in a stack of
Level
Level
Level
Level
Level
1:
2:
3:
4:
5:
c;.
log5(25) result intermediate result intermediate result log5(25) •...
,.,
f#
•
,.
"""
~
e
e
e
~
~
~
~
~
13
@J'
~
~.
''!l
~
~
~
~
~
(I!
~
,~
~
~.
'!'>
~
~
e
~
~.
tl!I
e
~
e
e
~
"')
e
",
C
~
Il;;
Level
Level
Level
Level
[result) (log5(25)]
intermediate result intermediate result log5(25)
1:
2:
3:
4:
ENGINEERING FUNCTIONS
When programming the user-defineable keys, you must pay
attention to the stack during each step to be sure that the
program will use the proper value in its calculations. Always
press HELP, then begin and end the program by pressing
the f key you are using. When you are calculating, the pro­
gram will execute each time you press that f key again.
CAUTION: When using an f key during calculations,
press the PUSH key before keying in f1, f2, or f3 if the
programmed sequence starts with a number. This is
necessary to put the new number just keyed in onto
the top of the stack. For instance, if the program se­
quence in f1 starts with 3 and you key in "12 f1", the
3 will be appended to the 12, resulting in 123 and
causing an erroneous answer. "12 PUSH f1" will give
the correct answer. If you don't remember exactly how
your programmed sequence starts, press PUSH be­
fore the f key just to be sure of correct operation.
Also remember to check stack levels. If a function
key's program uses three stack levels, it won't work if
you start with eight levels on the stack already.
~
II!
f/!:
e
(ROLL 4 would have deleted the last stack leveL) Now when
you press MULT, stack levels 1 and 2 are multiplied, and the
product of [result] x [log 5(25)] is placed on top of the stack .
Other values move up one level.
~
iii
~
For retention of that result for later calculations, you can call
on user storage (STO), or can use the higher levels of the
stack and then use PICK or ROLL. Say that subsequent
calculation results in the stack arrangement below,
Level
Level
Level
Level
(;
~
.. Calculate the logarithm with base 5 of 25.
Several formulas can be used - note that the Scientific
Calculator allows logarithm calculations to bases 2, e, and
10. We select
Key in
ij
1: -1
2: 1
LOGARITHMIC FUNCTIONS
1095(25)
.
~
.
~
";l>
FIX and FRAC
• Calculate x
[xl (find the value of a number less the
largest integer in that number). Let x =: 5.2345.
Key in
Display
Stack
PUSH 1: 5.2345
5.2345
DUP
1: 5.2345
2: 5.2345
5.2345
FIX
1: 5
2: 5.2345
5
5.2345
~~
:::<1'
:-:~
;~.
4>
tl.?
A .f'.}
w
~
SUB
1: .2345
•
-•
.2345
Or, better,
;)
5.2345
1: 5.2345
5.2345
FRAC
1: .2345
.2345
•.,
NOTE: See DIG in Section 3 for an explanation of
that takes place in the Scientific Calculator.
f.;;
e :.,
Modulo (y mod x)
Enter the y value first, then the x value. y is divided by x and
the remainder is multiplied by x and put on top of the stack,
replacing x and y.
Key in
(y) 275 PUSH
(x) 3 DIV
SHIFT FRAC
MULT
(x) 3
Stack
Display
1: 275
1: 91.66666667
275
(y value)
81.66666667
(x value)
.6666666667
2 (reenter the x
value = 3)
1: .6666666667
1: 2
You can program this routine
an f key as
HELP f3
Brings y value to top of stack.
SWAP
PICK 2 ENTER Duplicates x on top of stack so
that x at level 1 can be used to
divide y at level 2, and x at
level 3 will move up with each
calculation and be available for
multiplication at the end of the
calculation.
DIV
Divides y by x.
SHIFT FRAC
Drops integer and displays
remainder.
MULT f3
Multiplies the remainder by the
x value.
To use the program, key in: y value
'.
PUSH
x value
f3 Degrees/Radians
• Convert degrees to radians: n degrees x
ans
Program:
It Convert
Key in
~
":1\
f:
~
20
f2
~j
,1!It
11)
'IT
HELP
f2
180
11'
PUSH
f1
Convert degrees or hours, minutes, seconds to decimal
format. In this oxample, f1 and f2 are programmed to calcu­
late the decimal equivalent:
.~
Program:
[email protected]:'
.",
HELP
~,
.~
f!
,")
@
")
II!
e AI!')
e ~
e "",)
e ?
e
.~
It:
.~
e'
"~
e
' :;10
c;, ,.:;,
~
"7~
1:;.
~
~
.:-~
f2
DIV
Ii
1 minute = .01666667 degree 1 second = .00027778 degree ~
= degrees
.3490858504 (radians equivalent)
20 (converted back to degrees)
.,
@' !II
f1
DIV
Display
f1
.01666667
MULT
ADD
f1
(converts minutes and adds to degrees already en­
tered)
HELP
f2
.00027778
MULT
ADD
f2
(converts seconds and adds to degrees and minutes)
Example: Convert 3 16'25" to decimal format.
Key in
Stack
Display
3
3.2668656
(deg+min)
3.2738081
(deg+min+sec)
3 PUSH
16 PUSH
f1
1: 3
1: 3.2666656
25
f2
1: 3.2736081
PUSH
NOTE: If there are no degrees, key in "0 PUSH"
fore using 11 or 12.
&;#
~
A..A
180
Example: Convert 20 degrees to radians equivalent and then
convert back to degrees.
;&
,~
f1
radians to degrees: n radians{1
Program:
e
e:___
HELP
80) = radi­
.d.I'\
-
I
tjli)w
C.
Percentages and Conversion Factors
(ill
Compute a sales tax of 6'% and add to total purchase.
Program:
HELP
f1
DUP
Amount of purchase must be
duplicated
Calculates 6% sales tax
and adds to subtotal for
grand total
.06 MULT
ADD
f1
The va.lue you key in must be duplicated on the stack by the
program so that it will be available for both MULT and ADD.
Example: Calculate total bill for purchases of $25.96 and 6%
sales tax.
Key in
25.96
PUSH
25.86
27.5176
Example: Convert 25 liters to the quarts equivalent. Conver­
sion factor is 0.946.
HELP Key in
25
PUSH
f3
t..I.~
I
ei!)
el'!')
.946
MULT
f3
~.
.11)
~,
if)
~
<!II)
@!
III)
e
e··
23 + 65
(equivalent of
25 liters)
Factorials
" Find how many ways seven symbols can be arranged on
a straight line.
Program:
e
e
e:
e
t;;
t;::,
HELP f1
REC 1 ENTER Recalis the totai number of
factors stored here when
starting calculation.
?
~
~
,~
1 : 7 (Store total number of
factors)
1: 42
(7 x 6)
1:210
(42 x 5)
1: 840
(210 x 4)
1: 2520 (840 x 3)
1 : 5040
(2520 x 2)
1: 5040
(5040 x 1)
In the following example, pairs of numbers are entered. The
f1 and f2 keys are programmed to accumulate in memory
locations 1 through 6 the values x, x2, y, y2, xy, and the
number of paired entries. Several examples follow that are
based on these values.
~
:"?
SHIFT STO
ENTER
Summations
,,,
>?
Stack
STATISTICAL FUNCTIONS
.~
~
Key In to Use Multiplies stack levels 1 and 2.
You can press REC 1 ENTER to see which factor you
have just multiplied by. If you do this during calculation, be
sure to press DROP after recalling the factor; if you don't, the
next multiplication will be wrong because the wrong number
will be on the top of the ,stack.
,;II!)
Display
f3
.~
.:1IJ
Decrease number of factors by 1.
Store new total for recall.
f1 f1 f1 f1 f1
f1
el;'
~
@
1 SUB SHIFT STO
ENTER
MULT f1 7
1
fi,.
~! .~
• Convert from liters to quarts. The conversion factor can
be stored in a memory location from 1 to 12, but, if it is a
frequently used conversion, it is more convenient to program
it into an f key along with the multiplication.
Program:
c,:,..
I 'Ii
c,iii
e!
Display
f1
&I~
el~
i&1~
C.I~
",~
Location
Value
1
::Ex ::E X2
::Ey
::E y2
::Exy
2
3
4
5
6
number of pairs calculated
"~,f,'
II!I!!;
~~
;,1'
i~
4-7
r
~I
f:.< ,y,j
t, I;~
Program the keys:
Adds x to total in loc. 1.
Adds X2 to total in loc. 2.
Brings y to top of stack.
Adds y to total in loc. 3.
To terminate.
HELP f2
SHIFT X2
M+ 4 ENTER
DROP
MUlT M+ 5
ENTER DROP
Computes y2.
Adds y2 to total in loc. 4.
Multiplies x and y, which are in
levels 1 and 2, and adds the
product to the total in 5.
Adds 1 to the number of
pairs in 6.
Clears stack so it won't fill up
during your calculation.
Because there have been 15
keystrokes, the program exits
automatically.
1 M+ 6 ENTER
DROP
(f2)
Example 1: Calculate the above values for four pairs of
numbers. Remember that the first number entered for each
pair becomes the y value because it ends up on stack level
2.
iI!)
19
1'0
24
16
20
15
17
14
ENTER Y FIRST, THEN X
Key in:
SHIFT ClM
19 PUSH 10
24 PUSH 16
20 PUSH 15
17 PUSH 14
f1
f1
f1
11
I'~
t,
I ,~
Check the registers:
(il~
HELP f1
M+ 1 ENTER
DUP
SHIFT X2 M+ 2
ENTER DROP
SWAP M+ 3
ENTER DUP
f1
y:
x:
e
f2
f2
f2
f2
Zero locations 1 through 12
Do not press f2 until f1
has stopped calculating.
REC
REC
REC
REC
REC
REC
(;, I ,~
Gt
~
I ;-~
1'-­
" I -i
c;, I .~
(; I --~
e I ,:;.
ENTER
ENTER
ENTER
ENTER
80
1G2G
1 11 2
LI
x:
Examole 2: Calculate the arithmetic mean,
(2: x)/n and
(2: y)/n based on the input in Example 1 above.' .
GIl
f!,':;)
Key in
e:, '~
REC 1 ENTER 55
REC 6 ENTER LI
:'=,
DIV
(I! " ,
.,
~
@' ':t,}
~
:;!)
e
e
e
e
e
e
e
e
.,
.,
--!)
.!)
.~
,"")
number of pairs
Arithmetic Mean
..
I.,....
'It# I •.,.,
~
2:x
2: X2
2:y
2: y2
2: xy
1 ENTER 55
ENTER 777
2
3
4
5
6
Display
Fetches 2: x
Fetches number
of entries
Arithmetic mean of
x values
13.75
Use REC 3 to compute mean for y values.
Harmonic Mean
Example 3: Calculate the harmonic mean (the reciprocal
of the arithmetic mean of the reciprocals of a finite set of
numbers). You can program f3 to calculate 2: 1/x and 2: 1/y
while you are executing f1 and f2.
If/)
Program:
-j!­
HELP f3
Enter y value first, then X. PICK 2 ENTER Brings y to top of stack. 1/x M+ 8 ,~
t: ENTER
Puts reciprocal of y value in loc. 8.
e ?
?
DROP DUP
Brings x value to top of stack
and duplicates it for use
-":It
(;:
by f1.
-?
t::­
1/x M+ 7 -~
ENTER
Puts reciprocal of x value t::
in loc. 7. -'::~
t
DROP
i3
x
and
yare now in their :~~
iii original positions on the ~"j>
stack for the next ~
::~
calculations. ~
e
~
~
1&­
iLl:!
,1­
~
4·9
t... ' .
Key in to Execute:
19
24
20
17
PUSH
PUSH
PUSH
PUSH
10
16
15
14
f3
f3
f3
f3
f1
f1
f1
f1
I•
t,.
I-
~i~
12 f2 f2 f2 t,.. ! ..
t... : ..
Locations 1 through 6 will contain the same values as those
in the previous example. Check the new calculations.
Key in
Display
REG 7 ENTER
REG 8 ENTER
.3005852381
:S(1/x) .203121775
:SC1!y) ~
~
t,:­
Display
REG 8 ENTER
REC 6 ENTER
DIV
.203121775
4
.0507804437
1/x
18. B82B2035
.~
e
~
@­
~,
@
~
~
@:
@;
@
n{:S X12)
(:S Xj )2
n{n - 1)
1)
Note that some calculations use (n) in the divisor; however,
we use (n -1). To work through, this example, be sure that
the registers have the following data (produced in the SUM­
MATIONS section).
Key in
Display
REG 1 ENTER
REG 2 ENTER
REC 6 ENTER
55
777
4
4·10
12
B.81BBBBBB7
2.B28855B4
e
number of entries
arithmetic mean
of :s (1/y)
harmonic mean
of:S y
• Example 4: Using the data in memory from running Exam­
ple 1 or 3, find the standard deviation (sigma-<T) for the x
and y values. These calculations are based on the formula
4
1 SUB MULT
@
Standard Deviation
OUP
DIV .,
~
e
~
~
~
.
."
,Ii)
.~
~11:')
e
?
e
e
e
?
e
C
e
ii;:
:s Xi C
:Sxf n
~
'"
~
V
"?'
n(2:xf)
:s XI
(:S Xj )2
[n(l:Sxf)]- [(:S
DUPed to use
twice
n(n 1)
Means and Sums o f Squares
This example demonstrates another approach to these cal­
culations. Full retention of accuracy in computing means and
the sums of squares requires the use of techniques which
are somewhat inscrutable. The main problem is that accura­
cy is lost when the range of numbers is large unless adjust­
ment of the entered values by their means (or
approximations to their means) takes place at the correct
time. In most cases, the mean of a set of numbers can be
calculated by the formula
n
.~
., .,
:Sxf
3108
55
3025
83
<ii/II ~
777
REC 2 ENTER
REC 6 ENTER
MULT
REC 1 ENTER
SHIFT X2
SUB
REC 6 ENTER
.~
:S(1/y)
Using the same procedure but RECalling 7, you can get the
harmonic mean of :s x, which is 13.30693069.
Calculate sigma as follows.
e;
~.
Key in
::::
~
t<.i\
Now you can calculate the harmonic mean using the values
in locations 7 and 8.
-
t'.,
X
==
xi)/n,
i
If memory is available for total array storage, then the most
accurate method is to sort the numbers into numerical order,
and then to sum in longer precision than that of the individual
numbers. If the range of the numbers is large, and small
memory is available, then the mean is best calculated by the
recurrence relationship
X k+ 1
xk
+
(Xk + 1
xk)/(k
+
1)
where
+':)
?
·:t
:<l'
Xk+ 1
is the (k+ 1)st entry and
Xi = Xi
is the first entry.
Similarly (although we will not exemplify with a programmed
example), the recurrence relationship for an accurate sum of
squares may be of value.
~~:..p.
:,~
;~ 4·11
n
s
.L (X;
_
i
i
X)2
~
1=
~
~
should use
Sk+l ::::; Sk
+ k(k+ 1) [(Xk + l - xk)/(k+ 1)]2.
O.
where Sl
(Note that if the total array of x's could be held in memory,
then the actual mean could be found directly and could be
used for adjustment in calculating the sum of squares.)
In calculating the mean, we will
1. Set k to 0 in user memory location 6; set memory
location 7 to zero, for use in retaining the approximations
to the mean.
(;. CIf·
f#
3. Calculatexk+ l and increase kto k+1 and iterate steps
2 and 3 as many times as required.
C;. ~
e
~
e
~
e ';'
~
~. ~
2a. The f1 key will calculate the factor (X k+1 - xk)/(k + 1) and
will increment k to k + 1 in register 6. It is assumed that the
user has typed in Xk + l so that it appears on the displ~ (Le.,
is on top of the stack) and that k is in register 6 and xk is in
register 7. To set up the functions, type
OIV
f1
"
:JIj
~
.~
,~
2. The original step 2 (entering Xk+ l ) cannot be programmed
but the function keys can be set up to compute the new mean
as each new value is entered. Because more than fifteen
keystrokes are required, the task will be split between the f1
and f2 keys.
SHIFT STO 6
ENTER
~
~
ENTER
ENTER
1 ADO
~
:i
'" ~
1. To start by setting k to zero in register 6 and the result to
zero in register 7, type
HELP f1
REC 7 ENTER
SUB
REC 6 ENTER
",.
~
2. Enter Xk+ l
CLS 6
CLS 7
x
2b. Now all that remains is to add the original mean k to the
mnriifi~l'Itinn (X..
x. )Hk+ 1). It will be saved in register 7.
Type
?.I)
1J)
1111\
'"
...~
!:,)
¢~
..~
e 0~
'~.
start Droaram
_
get x k
get Xk + l ­ xk
~
HELP f2
REC 7 ENTER
ADD
SHIFT STO 7
ENTER DROP f2
4·12
save it
remove it from the stack to
make room for Xk +2
to terminate
Example: compute the mean of 4, 8, and 7.
CLS 6 ENTER
CLS 7 ENTER
4 f1 f2
8 f1 f2
7 f1 f2 ENTER
REC 7 ENTER
set k
0
set Xo
0
do Xl
4
do x2
8
do Xg
7
to display results: 6.333333333
3. A considerable portion of the previous sample is devoted
to the use of register 7. If you just want to calculate a mean
in one sitting (that is, you don't need to save the result for
adding in more factors later), then this shorter program is
adequate. Here you just leave x k on the stack as you type
Xkt1 ·
HELP f1
PICK 2 ENTER Xk is .Q.n the stack
xk ­ xk
SUB
REC 6 ENTER
1 ADD
get k, add 1
SHIFT STO 6
ENTER save k+ 1
DIV [X k +1_ - xk]/k+1
add x k
ADD f1 Example: compute mean of 4, 8, and 7.
~
STO 6
ENTER DROP
get k and add 1
save k+1
Note: k + 1 still on stack
xk)/k+ 1
get (X k+ l
to terminate
start
get xk
add modification
4
~
::'"
PUSH
8 f1
7 f1
set k = 1
since Xl =
do x 2 = 8
do Xg
7
)(,
Note that PUSH is not necessary after 7 and 8 before press­
ing f1 because the f1 program does not start with a number.
It:
4·13
(,
,,~
Ie;,
~
An Investment Problem
if;;; ~
Over the past several years, the annual inflation rate has
varied in a range from four to fourteen percent. Statisticians
say that that rate has averaged nine percent, with a variation
of two percent; that is the rate distributed normally with mean
9 and variance 2.
(#
~
~
~
~
,,~
~
~
~. ~
~'
'j
~
oj
~
~
e
~
t
~
e: ~
~
~
~
~
If this is true, and a randomly selected group of investors
were able to invest so as to keep pace with inflation, what
will be the value of their portfolios at the end of a specific time
period?
Let us assume that each invests in a fixed-interest-rate ac­
count for a two-year period starting at a randomly selected
time during the period through which the inflation rate was
tracked. It is assumed for this calculation that interest paid
was fixed at the inflation rate at the time of the investment.
We calculate the value of each account at the end of its
specific two-year period.
To examine this situation, we examine hypothetical investors
by simulation.
First, we generate a random inflation rate using the normal
generation operation Xn with mean 0 and variance 1. Then
we transform it to a rate with mean 9 and variance 2. Next,
considering that we invest and review our situation monthly,
we change the random rate to a monthly rate. And, finally,
we calculate the amount one dollar would be worth if in­
vested for n months at that rate.
~
~. ~
~ e
~
e Generate a normal (0,1) random deviate r'.
e
e
e:
e
e Transform it to r = V2
variance 2 at this point).
Mathematically, the problem can be stated as follows.
r' + 9 (r has mean 9 and
e Change r to a percent and then to a monthly inflation
rate m
= r/12.
• Then (1 + m)n is the value of one dollar invested for
n months at m% compounded monthly.
First, we will write the program, and in doing so, initialize
certain program elements so that easy repetition of the simu­
lation is possible. Then, by using the programmable keys f1 ,
f2, and/or f3, we will simplify the operations, reducing them
to a few keystrokes. We assume a clear stack at the begin­
ning.
,
2
Y-
SHIFT STO
2
ENTER
Let us put 7325 in register 12 to serve as a seed for the
random number generator (Xn), type;
7325
SHIFT STO
12
ENTER
At this point, the values square root of 2 and 7352 remain
on the stack. To discard them, type
DROP
DROP
Now the HHC is properly initialized for the investment prob­
lem. We will run through this problem step by step.
1. Generate 'the normal random deviate, r' by pressing
:gn (.4278677851)
2. No~transform r' to the desired range by the formula
x Y2 ) + 9. Key in
,-'
-:11)
,"
,?
(1.41423562)
( .6050964246)
(9.605096425)
REC 2 ENTER to get Y2
MULT
r' x Y2
9 ADD
+ 9
3. Change to percent by multiplying by .01. Key in
.01
(.09605096425)
MULT ,.")
,,,
;~
4. Now get the monthly inflation rate by dividing the yearly
rate you have just calculated by twelve. Key in
(.008004247021 )
12
e
.~
e
':1-
(Note: (r x .91 )/12 = r/1200 in steps 3 and 4 can be
combined as 1200 DIV)
e
,"1>
e
::'i"
e
?
". '"
(::
(;
~
~
~.
~
(r'
"
.:'),'
e
~
4·14
,
To put the square root of 2 (the desired standard deviation)
in register 2 for future use type:
';:!
~'t-
:'t
;A!
DIV 5. You now have the value m (the monthly inflation rate).
Recalling that (1 +m)n is the value of one dollar invested for
n months at m% compounded each month, we are now
prepared for the final computation. If n = 24 months, type
(1.008004247)
1 ADD
24
1 + m
24
yx
+_ ....... i,...,_ -t
LU
I ClI;,:)v
I
~t""I"'\
!
to the 24th
power
eft
"tt
"
4·15
III
(1
"1I"\A~7~77'
\ I .'
­
..., _ _ ...... I
• I
~
j
,~
The final result is now displayed. It represents the value of
1 dollar invested for 24 months at a 9.6% annual rate com­
pounded monthly. (f you want to save steps 1 through 4 for future reference,
the function keys f1, f2, and f3 can be used.
;t,. y
G
,.
SECTION 5. FLOATING ..POINT
NUMBERS AND ALGORITHMS
:~
(;; i
'.
c; i
Gw,19
i\
e,
.~
e ~
e ~
e;'
'~
@', e:'
~,
FLOATING-POINT NUMBERS
ALGORITHMS
A floating-point number is constructed as follows. (REMEM­
BER that all "construction" takes place automatically when
you enter a number through the keyboard. This detailed
information addresses those who may wish to use the scien­
tific capsule as a library capsule, and who require preCise
knowledge for use in other prograr:nming environments).
The floating-point number requires eight bytes (each con­
taining eight bits) of memory.
The first 12 bits (i.e., low memory address) are used for the
•
sign bit (0 for positive numbers, 1 for negative numbers)
19 exponent bits (eleven bits). These allow an exponent
range of from 1023 to 1023; the exponent is considered
to be a power of ten; a bias of 1024 is added; an exponent
of zero (ten to the zero power, or 1) is bits 10000000000,
binary, or 1024 decimal.
@,
~
.~
@" "
~
'~
,~
e
.~
~
"~
If'
~
e· ' :')
The remaining 52 bits are used to hold the mantissa in BCD
format as follows.
II!I
The first 4 bits contain the integer part of the floating­
point number. A decimal pOint is implied after this byte.
®
Each of the last thirteen half bytes (4-bit groupings) is
considered to be one decimal number by the arithmetic
componentry.
~
e
';'dl
e~
e~
This system has many useful features.
•
~
t::
C" ''5\
."';~
:4:
If:;, ~
~~
~,.,
;'"
Excellent symmetry properties exist (see Section 6). For
example, the largest number multiplied by the smallest
number is very nearly unity (1). The largest positive num­
ber is the negation of the largest negative number.
e All valid floating-point numbers are "normalized", That is,
the integer part is non-zero for a!! non-zero values.
@
The actual number is taken to be the thirteen-digit integer
+fraction multiplied by ten raised to the power (unbiased)
stated in the exponent area.
"
4-16
~ ,'"
fi-1
;t.'"
"
• All other types of floating-point numbers are INVALID,
and are generally the result of calculations which should
not have been performed (divide by zero, logarithm of a
negative number •...•). A result of this type is detected by
the error-handling system. and an error message is dis­
played.
To use the Scientific Calculator effectively, you need not be
concerned with the actual construct of floating-point num­
bers. One example will be enough to demonstrate the con­
cept.
If you enter the number -123.4567, using --123.4567
PUSH, the top of the stack will contain that number in float­
ing-point form as shown below (in bits).
1 1000000j0010 000110010 001110100 010110110 0111]0000 0000
~
exponent
1. 2
3
4
5
6
7
0
0
~
.~
~
~
'.
i
c;
­
(:,
~ .i
~
(i
e~
+ .....
The exponent above is 1026 in decimal form, which implies
that ten is raised to the power 2 (1026-the biased form of
2), and that result is multiplied by the integer+fractional
part of the number.
The Scientific Calculator allows entry of numbers using
scientific notation. The number above can be entered as ­
1234567E3 (E3 implying multiply by 10 cubed), or as ­
1234.567E - 1. Both entries result in the internal representa­
tion shown above.
Section 6 summarizes the boundaries of this floating-point
system. and provides information on such numbers as m
(maChine infinity, the largest representable number) and
eps. the smallest non-zero number.
MATHEMATICAL FUNCTIONS
e
'
f." .
For arguments in the domains noted in Section 7, the follow­
ing functions are approximated to give the maximal accura­
This means ten significant digits in many cases, since
een-digit arithmetic is available. Exceptions that may
exist are noted in Section 7.
~
~
~
~
.~
~
"
Tan(0.6) =:: 0.6841368083416, correct to less than one digit
in the thirteenth place.
.~
Arctan (0.6841368083416) =:: 0.5999999999999, correct to
within one digit in the thirteenth place.
e
e
e
• The results of operations cannot exceed the range of the
floating-point system. As an example, consider
101000/10--1000
~
."
~
)II~
e
-~
-'1>
~
-~
Just as in standard operation, the numbers 10000 and
0.0000000001 cannot be added in 13-digit arithmetic if
full significance is desired in the result. If two operands
having exponents that differ by more than 12 are used in
addition or in subtraction, the result will be identical to the
number with the larger absolute value (10000, in the
above case, in addition).
e
~.
I".,.
?
-~
e
In practice, a rounded result is displayed in the two cases,
so that if ten digits were requested, then 0.6841368083 and
0.6 would be displayed.
Consider now the result of the following operations:
tan(0.6) atan (result)
atan (that result) ... tan After many of the above iterations, the error of one digit in
the thirteenth place would cause final results to stray from
0.6 because the result is 0.5999999999999 after the first
iteration.
~?
~~
,. .'"
GENERATION OF RANDOM DEVIATES
Uniform PseudcH"andom Deviates
~
"<I>
102000 .
n.?
Corisider the following situation: Calculate tan(0.6 radians).
Then calculate arctan (the result).
e
'
e "
REMEMBER:
I} A review of Section 6 can help you design calculations that
avoid these situations. I f calculations cause violation of the
floating-point system boundaries (Section 6) or use the more
complicated mathematical functions in a way that makes
adequate results impossible (Section 2 and Section 7), a
warning message (Section 8) is displayed. Section 7 defines
error types by function, Section 8 by error number.
e .;.
~,
point is implied after
-. . . . . . . .. . . . . . . . . . . . . . .. . (zero bits to a total of 64 bits)
The maximum floating-point number (Section 6) is less
than that result; in this case overflow (ERROR 2) would
be signalled. The operation 1.010.0 will cause a divide
check error, as a limiting case of overflow.
A sequence of positive integers x is generated by the recur­
sion
1) =:: 16807x{i) mod 2147483647.
~
,r
5·3
"
~
~
~
The seed x(1) is presented to the program as an integer in
floating-point form in the range [1 ,2147483646J. Subsequent
x's [x(i+1)] can be used on the next program usage.
Before use of the recursion, x is scaled to a floating-point
number in the range (0, 1), and returned. The floating pointinteger x(i+1) is stored for use in the next generation.
Each integer from 1 to (231 2) is generated once in each
cycle, and the deviates generated are transportable. That is,
deviates thus produced can be reproduced by using the
same seed, x, in a correct implementation of the algorithm
for another machine in this language or in another one.
For uniform deviates in the range [a,b], the above generator
can be used, and the resultant deviate u then transformed
by
u'
(b
a)u + a.
Normal Pseudo-random Deviates
(Reference 3)
For normal deviates with mean 0 and standard deviation 1,
the uniform(0,1) generator above is used, and two deviates
are generated, u and v. Then,
X :; sqrt
(8/e) (v - 0.5)/u is obtained.
These operations are repeated until
X2 .<:
4/Ln(u);
X
is the desired deviate.
For normal deviates with mean u and standard deviations,
the above normal [0,1] generator can be used, and the re­
sultant deviate x transformed by
X' :;
sx + u.
t,
~
~
~
(,f.
(If
..
"
(I
~
{f
~
e,.
~
~
e
e. '!i
~
!I
~ II!:
JI;
e
.~
e:
e
~
The floating point numbers given below represent parame­
ters which define the boundaries of the floating point system
used in the HHC. Violation of correct number usage will lead
to a floating point operation error (See Sections 7 and 8) .
Notation
Number
Parameter
@I!
e
i''.'iI
")
~
~
~
e
e:; ':)
e
,~
~
largest floating-point number
-m:
largest negative floating-pOint
number
eps 1:
smallest positive number which,
when added to or subtracted
from 1, gives a result not
equal to 1.
10- 12
eps:
smallest positive number
10- 1024
-eps:
negative number largest in
absolute value
_10- 1024
eps':
smallest positive number such
that it and its inverse can be
inverted, and such that the
inverted inverse is the
original number.
1 .000000000001 E - 1024
1 - epsl: largest number less than 1
~
"fl
::;!Ii
'~-4\
.~
f;
~~
F,
-~~
-~~"
If
!'i.A.
~.
'.1'>
·t 9.9999999999 x 10 1023
m:
1)
:J)
e
e
e
PARAMETERS
W
f" ...
.
tf
SECTION 6. MACHINE
6·1
·.. 9.999999999999 x 10 1023
.9999999999999
,
:,
.f;.1 ~
~
~
~
1
~
~
(J
,
~
;, e
~
•
e
~
e
~
t:
~ e:
~
@;
~
II! ~
~.
~
e:
~
e
~
e ')
e
e
e
e.
e
e
e
~
II)
':J
~
~
':l
';I ~
';I
c:
~
".!
';,j
'"
',,$
~tl
~'!l
!1i.
:'1
'<1
~
SECTION 7u OPERATION KEY
PARAMETERS
GENERAL INFORMATION
Section 7 summarizes pertinent information about the Scien­
tific Calculator operation keys. The codes used for argument
domain and function range are explained in Section 6. Stack
control notation is explained below. Before
Operation
X
After Operation
---> ._.>
X
X
--->
sin(x)
y,x
--->
yx
Example of applicable execution
DROP - drop top item from
the stack
REC
recall from memory and
put on stack
SIN - replace top of stack
with its sine
MUL - replace top two entries
with their product
Our convention for noting stack values is that level 1 value
x is always presented to the right of level 2 value y. x repre­
sents the number on the top of the stack - level 1. Y repre­
sents the next number on the stack -level 2. When an input
key has the letters x and y on it, x represents the number on
the top of the stack (it appears on the display), and y repre­
sents the next number down.
The x or y,x on the left of the ---> arrow shows stack contents
before the operation being discussed; the group on the right
of the ---> arrow shows stack contents after the operation.
At most, only the top two levels are considered. The stack
holds the argument or arguments for the operations; the
result of an operation is always placed on the top of the stack
(level 1) and in memory if the M+ and M - keys are used
(or in memory location 12 when generating random devi­
ates).
Numbers keyed in will show on the display but do not go onto
the stack automatically. In two-argument operations, the first
number, after being keyed In, !liust be pushed onto the top
of the stack by pressing the ENTER,PUSH,DUP key. When
the operation key is pressed (such as MULT) after the sec­
ond argument is keyed, the second argument is momentarily
pushed onto the stack and then both arguments are replaced
7-1
.
••
by the result of the calculation, which is put in level 1. It is
important to know what is at levels 1 and 2 in the ATAN2,
SUB, DIV, XY operations.
In one-argument operations, pressing an operation key
(such as COT) after the argument is keyed.in will push the
argument onto the stack momentarily (pushing present stack
contents down one level) before it is replaced with the result
of the calculation. However, no harm is done if the number
is PUSHed before the operation is pressed.
SYMBOLS
II
II
It
411
GIl
CIt
•
•
Ii
m, eps, ... : refer to Section 6
c(n) symbolizes "the contents of floating point storage
location n"
m, as noted in Section 6, is machine infinity
na is used to imply "non-applicable in this case"
(x] is the symbol for "the greatest integer in x"
( ) implies that the interval is open
{] implies a closed interval
> greater than
< less than
FLOATING-POINT ERRORS
error 2:
error 4:
overflow; result < - m or result> m
divide check; division by zero
These errors can occur if incorrect operation is requested.
In the underflow case, when a result is less than 10- 1024 in
absolute value, but not absolutely zero, our implementation
of the floating pOint arithmetic operations sets the result to
zero, and does not trigger an underflow error. However, if the
capsule is being used as a library program (see Appendix C),
underflow can occur.
the basic mathematical functions discussed below
protect against the above errors, operations preceding or
succeeding use of these functions can result in such errors.
For example, in raising 10 to the power x, first
multiplied by x. Then the exponential routine, e to the
x, is entered. The initial multiplicaiton can cause an overnow
if x is too large (for example, m). Then, ERROR 2 (overflow)
'vvill be displayed.
If the result of any calculation is "ERROR N", (error discus­
sions are given in this section and Section 8), then the an­
swer that would have been the top stack element is
automatically dropped.
j.
BEEP Warning: (Any stack conflict will cause a beep.)
•
• if a number is entered which cannot be converted to an
internal floating point counterpart
~
:1:
~I·
C$I(fl~
t; ~
I
ei~
" if an operation key which does not have a counterpart
in the Scientific Calculator is pressed
if the user addressed a non-existent memory register
(location)
411
• if PICK or ROLL is requested and an n out of range is
selected
if store memory (STO) is requested and the stack is
empty
111\
if DROP is requested and the stack is empty
~
<I
~
.,
• if SWAP is requested with less than two numbers on
the stack
~
ill!!
e
e
~
.,
e
e:
.
e- ..'"."
e AI)
e ..,
e
":'.!'
e .,
e
~.
~
e
c: e
e
e
?
'?
I»
if +, -
I
etc. are used with one operand
ARITHMETIC FUNCTIONS
ADD (+)
MULT (x)
y,x--->y+x
y,x--->y-x
y,x--->yx
DIV (/)
y,x--->y/x
SU8(-)
Domain: (
m,m] for both x and y
Range: [- m,m]
ERROR 2: overflow; result
<
m or result> m
ERROR 4: divide check; division by zero
?
.~
?
"2
'?
Note that if two floating point numbers are added or sub­
and their exponents differ by more than 12, the
result will be identical to the number with the larger abso­
lute value. If the absolute value of the result of an oper­
ation is less than 10 1024, it is set to zero.
?
~~,
~ -:~
TRIGONOMETRIC FUNCTIONS
SIN
x--->sin(x)
~.
~
ti
:~
Domain: {- 1 02942,1 02942J radians
{- 5898142,5898142] degrees
.,!!
7·3
I
~I·
....
,.
I~
Range: [-1,1
ERROR 9: x is out of the domain noted above
COS
x--->cos(x)
Domain: [-102942 - Ti/2,1 02924 - Ti/2] radians
[ - 5898052,5898052] degrees
(41:
I
~I"
ATAN
x--->arctan(x)
Domain: [- m,m]
Range: [-Ti/2,Ti/2] radians [-90,90] degrees ATAN2
x,y--->arctan (y/x)
Range: [-1,1]
~I·
ERROR 9: x is not in the domain noted above
t;,1"
Domain: x in [ yin [ lit;il
I
Range: [ Ti,Ti] radians [ - 180,180] degrees e::~
ERROR 11: x "" y
TAN
Domain:
x--->tan(x)
r-
51471 ,51471] radians
2949071,2949071] degrees
Domain: [- 51471 ,51471] radians
[ - 2949071,2949071] degrees
m,m]
< eps'
ERROR 7: I x I > 51471 radians
ASINi
Domain: [
x--->arcsin(x)
1,1]
Range: [- Ti/2,Ti/2] radians
[ - 90,90] degrees
ERROR 12: IX! > 1
ACOS
Domain: [
,.:.,
;I~
x--->cot(x)
ERROR 6: x
ACOT
0 or x = 0
x--->arccot(x)
~
ERROR 7: x is out of the domain noted above
Range: [
Iti:>
~I~
Range: [- m,m]
COT
:­I .
@: @:. ~
e
~
e~
~
e
,.
II!
Ii::
1,1]
.II)
..,.
ee ..,.
e .,
'"
I?
e
x--->arccos(x)
~
Domain: [- m,m]
Range: [O,Ti] radians [0,180] degrees NOTE: Reduction of the arguments used in trigonometric
functions can cause accuracy degradation, since x is modi­
fied to lie in the principal domain (e.g. [- Ti/2,Ti/2] for SIN).
The program produces ERROR 9 when the argument is so
large that accuracy will degrade more than is acceptable.
This situation applies to SIN, COS, TAN,. aFld COT.
HYPERBOLIC FUNCTIONS
SINH
x--->sinh(x)
Domain: [-m,m]
?
Range: [-m,m]
?
If x is such that sinh(x) >
?
?
Range: [O,Til radians
[0,180] degrees
?
ERROR 8: Ixl > 1
?
COSH
=
m, then sinh(x) is set to m.
x--->cosh(x)
Domain: [- m,m]
?
Ci
Range: [1,m]
If x is such that cosh(x) > = m, then cosh(x) is set to m.
I!r;"
..It.
;;
7-4
7.l';
, "
TANH
x···>tanh(x)
.~.
e,
;I
.,
,,.
Domain: (-1,1)
Range: [- c,c] where c
ERROR 10: I x I >
If;j:
~ ERROR 2: overflow in
~.
~.
ERROR 13: x > 1024 ~
~
15.313376694
1
~
Domain: [- m,2357.847135225]
c;
;J
Range:
t
e:
Range: [- m,3401.654369165]
e
lOG 10
x--->logiO(x)
a
e:
x---> 1n(x)
e·
e
<=
Domain: (O,m]
Range: [- m,2357.847135225]
ERROR 14: x
2x
.,
j1J
"
"
..,
"
e: "
e:
Range: [-m,1024]
LOGe
e:
<=
a
x--->2x
Domain: [- m,3401.654369165]
If
"
"
"
"
e: . ""
e;:
e' . '"
ik
\g7
"
, ""
/jI
~
~"'nt't<l'
In ..,,1
, .'-'1.1 ':::;:1""""'C L-f* tfJ
ERROR 13: X > 3401.654369165
".
fu
if
ERROR 13: x > 2357.847135225
~
e:e" "..,
Domain: (O,m]
ERROR 14: x
.~ ..
.
Domain: (O,m]
a
x--->ex
ex
<fr
LOGARITHMS AND EXPONENTIALS
x--->log 2 (x)
O)x prior to ex entry
~
e:
<=
m,1 024]
Range: [O,m]
~.
x-··>arctanh(x)
ERROR 14: x
Domain: [
x---> 1Ox
~
Range: [- 1,1] lOG:!
10x
~.
Domain: [- m,m] ATANH
("
"
?
~
/;1
ROOTS AND POWERS
xv
y,x--->XY
Domain: x in [
yin [
Range: [
m,m]
m,m]
m,m]
ERROR 2: the multiplication xln(y) caused an overflow
ERROR 13: xln(y) is too large an argument for the ex
program
ERROR 15: x
ERROR 16: x
0 and y <= 0
< 0 and y is not an integer
See the note describing the nth root, below.
y,x--->yx
Domain: x in [
yin [
m,m]
m,m]
Range: [
caused an overflow
ERROR 2: the multiplication
ERROR 13: y!n(x}' is too large an argument for the
program
ERROR 15: y
= 0 and x <
0
ERROR 16: y < 0 and x is not an integer
;.
7·7
~
..
..
~
~
See the note describing the nth root, below.
~
X__ ->X2
)(2
f;
~
Domain: [-sqrt(m),sqrt(m)]
G
Range: [O,m] ~
ERROR 2: overflow; result < -- m or result> m 1/x Domain:
x--->1/x
[-m,mi
~
~
~
~
~
~
~
~
~
~
~
~
~
Domain: [O,m]
~
~
Range: [O,sqrt(m)j
f: .",. nth root
~. e.
X--->Xlln
!!: .,
.~
e"
Domain of n: integers from 1 to 50 inclusive e. ~
1IIl·. "'II
ERROR 16: x
<
e;:
~"
°
...,.
e: ...,.
e;: ...,.
oe;v
In the HHC, XY and the nth root are calculated using,ex1n(y).
Because thirteen-digit arithmetic is 'performed, if y and
x are accurate to machine precision, then the result
should provide ten or more digits of accuracy.
In the nth root, if n is large and x is near 1, the result will
be 1. n is limited to 50 in the nth root, but the user may
consider the other power routines as an alternative for
larger values of n.
C': ?
C: ...,.
t;:
'?
C: '?
~. T~
~
,...,.
?
Xu ---->u(O, 1)
Prior to use of any generator, a floating point integer seed
in the range [1,2147483646] must have been stored in
storage location 12.
If the user violates this seed requirement, a specific seed
is selected by the generator. Thus, the same deviate
stream will be produced on any seed range violation.
ADDITIONAL FUNCTIONS
FRAC x--->x-{x} where {x} is the integer
portion of x
Domain: [- m,m]
Range: [0,1)
The significand (mantissa; fractional part of the floating
pOint x) is returned.
FIX x--->[xJ
Domain: [- m,m]
Range: [- m,m]
The integer part of x is returned.
Ixl x--->Ixl
T~
~~"
RANDOM NUMBER GENERATORS
~:
?
~:
~~
~., ~:;,
Domain: [- m,m]
Range: [O,mJ
.....
Domain: seed in [1,2147483646] at memory #12
7-8
~..
!i;-:­
°
">
Domain of x: [O,m] Range: [O,m lln J
Domain: seed in [1,2147483646J at memory #12
n(O,1) is a pseudo-random normal deviate with mean
and standard deviation 1.
~
ERROR 4: divide check; division by zero °
---->n(O, 1)
~
~
ERROR 3: x <
Xn Range: [- m,m]
~
x--->sqrt(x)
°
u(O,1) is a pseudo-random uniform deviate in the exclu­
sive range to1.
~ ~
Range: [_. m,m] sqrt Range: (0,1)
~
.. ...
7·9
w
(;. I •
CHS
Range: [- m,m1
MEMORY REGISTER HANDLING
BEEP: fewer than two numbers were on the stack
~;.
(This presentation is non-standard to emphasize the fact
that the contents of the top two stack locations are
swapped.)
~l:
PUSH
[­
~I"
Clears all floating point storage locations to zero.
ClS
Clears a user-selected storage location.
x--->x
STO
x at
REC
user-selected location n.
---->x
The recalled number is moved to the top of the stack.
M-
e
e
l
~
!>
el~
~I~
e.iIIII!
If any operation key is pressed after keying a number, that
number is automatically PUSHed onto the stack momen­
and is then replaced by the result of the operation.
e
e:
iIIII!
1
"
e:
e
IIJ
IIJ·
"
~
"
~
BEEP: the floating point stack was empty
(This presentation is non-standard to emphasize the fact
that y. the level 2 value, becomes the new level 1 value.)
DISP
"
ee ",
AND CONTROL
y,x--->y
After number entry or operation, PUSH duplicates the
number on top of the stack, leaving it in positions 1 and
2.
NOT E: If n is out of the range 1-12, the HHC will beep. In this
case, the prompt for reentry of n is displayed. The user can
reenter n or press CANCEL to omit the operation.
STACK If the floating point stack is filted, HEIGHT WARNING
appears on the display, and new numbers are not ac­
cepted. Store to memory and drop, or drop elements from
the stack.
.. I .. <r- I ­
e
x·_->x
Memory is changed; c(n) + x replaces c(n). Note that the
memory contents can cause an overflow (ERROR 2).
DROP C/E
I ;; e!"
x--->x
Memory is changed; c(n) - x replaces c(n). Note that the
memory contents can cause an overflow (ERROR 2).
M+
f;.
--->x
ERROR 5: the number entered is out of the range
I"
ClM
y,x--->x,y
f;'~
~!~ Domain: [- m,mj
Stores
SWAP
'" I ~
x--->-x
"
When this key is pressed, first the stack height (number
of elements on the stack) is displayed. Then, repeated
pressing causes elements on the stack to be displayed
in top-down order until the last element has been dis­
played. Then the display reverts to keyboard mode, and
the value on top of the stack is displayed. Press CANCEL
to stop the display cycle in mid cycle to return to keyboard
mode.
PICK
,xn
BEEP: n is out of range. In this case, the prompt for
reentry of n is displayed. The user can reenter n or press
CANCEL to omit the operation.
PICK prompts you for the value of n, and then pulls the
nth stack element to the top, retaining it at position n.
ROll
;:;.: .~
xk,..,xn, .. ,x1 xk, .. ,xn, ..,x1--->xk, ...x1,xn
ROLL prompts you for the value of n, and then pulls the
nth stack element to the top, deleting it from its original
position.
~
6::
7·10
~'.'I. 7·11
-
"I·
I·"
~
CONSTANTS
---> euler's constant
'Y
Range: 0.5772156649015
--->
11"
I
"'Iii
f;1"
CANCEL
Cancels the stack display cycle and returns to keyboard
mode. Also, this key is used to cancel operations that
prompt you for a number (such as DIG, CLS, and STO)
before you enter the number with the ENTER, PUSH,
DUP key.
~I~
"I·
~i~
11"
Range: 3.141592653590
OPERATIONAL CONTROL
DIG
v·
~l-
(,j;
After pressing the DIG key, the user enters n. Thereafter,
n digits rounded are displayed. More than 12 digits will not
be accepted. The HHC uses 13-digit arithmetic; math­
ematical functions can reasonably provide 10 digits in
most cases. Exceptions are discussed in this section.
To clear stack and keyboard without destroying contents
of memory locations 1 to 12 or program keys f1 , f2, and
f3, press CLEAR once. To return to the HHC primary
menu, press CLEAR twice (NOTE that this will destroy
the contents of memory locations 1 through 12). CLEAR
will cause the SCI and DIG functions to revert to their
default values.
.-
~I~
41";1­
~
~I:J
1:.
BEEP: n is out of range
CLEAR
1
f!1~
e·.·
e
I
I
'"
~
6:1~
~ I· INPUT AND EDITING
ENT EXP
Used in conjunction with scientific notation entry. e~~
SCI
Toggle switch, initialized to cause standard notation to be
used on output. Pressing the key causes output to be
displayed in scientific notation (that is, as x.xxxxxxxxEyy)
where the number of digits is defined by using the DIG
key, and the exponent of 10 is signed. The effect of the
key is retained until it is pressed again. The DELETE blip
shows on the display when SCI is on.
DEG/RAD
Toggle switch, initialized to expect radian arguments in
trigonometric functions and to present radian results in
inverse trigonometric functions.
Pressing the key causes conversion to degreees mode;
that is, the calculator expects arguments to be presented
in degrees and returns results in degrees. The effect of
the key is retained until it is pressed again. When the key
is pressed, it has no effect on numbers already on the
stack.
The INSERT blip shows on the display when in DEG
mode.
e.!~
e
e
~
.,
e
e'
~
e
e~
e
e
?
':J
?
C
If,:
?
~.
~~
':J
,,...:
~
Ij,~
~
+/­
Used to enter the sign of a number. + can be used to
emphasize a positive number on a printout, for instance.
~
"
"
(!:
Used to enter decimal points.
~
e
1,;,
7·12
Q
~i~
':J
~
and
oE­
Used to move the cursor forward and backward.
PROGRAMMING KEYS
11, f2, f3
User-definable keys, each of which can represent a se­
quence of up to 15 keystrokes that will be executed when
the key is pressed.
~
~
;I
..;
~
,)
7·13
~,
•
I .,
SECTION 8. ERROR MESSAGES
~I,))
(:~
,.
I .,
This section presents error conditions in numerica.l order.
Full descriptions of error situations are given by key name
in Section 7. Section 6 defines eps and the other boundaries
of the floating point system.
I~
(1;.
;;J
I~
~!iJ
e
e
2
::;p
~
~.
e
~
.,"
@;
V
DIV,1/x,V
keyboard entry
9
zero divide
number entered out~
side of the
possible range
Ixl < eps
x out of range
Ixl> 1
x out of range
10
Ixj
11
12
13
x = Y = 0
Ixl> 1
x out of range
6
7
~
8
e
•
ee ..
e
x<O
4
~
A!)
.., ~
e
e .,
14
xsO
15
X
X
e
e
e
16
fE·
'1!'
e·
e
~
.,
•
ADD,SUB,MULT,DIV,
M - ,M+,10 x,xy,yx
floating pOint
overflow
3
5
t:
OCCURRENCES
ERROR DISCUSSION
!'"
~
1
xv
0, Y < 0
< 0,
< 0,
°
yx
y =
x
y not an
integer
y < 0, x not an
integer
xy
yx
NOTE: Press CANCEL to cancel the error message
and return to keyboard input mode.
.""
'" '»
~
p.
"',....
IJl
'<I;
;
~ ~
.~
'f'
/)
If'
.~.
ii'.
cot
cot,tan
acos
sin,cos
atanh
atan2
asin
2x, ex, 10x, XY, yx
log2' log10' loge
8·1
,
tfi~
!~" SECTION 9. HHC AND C? II "..
SCIENTIFIC CALCULATOR SYMBOLS
Gtj.;J
~!~ lWi ri
HHC
"I~
~l"
CiI:
i
I
ri
~';)
~ ~
e;. ~
e
~
e
f!:
e
~
~
.,
e .,
e
e:
e
e
e
e
,e
,
,: ~'
~
I!j!
SPACE' CANCEL
ASIN
SINH
#
lOGm
$
IXI
FRAC
%
SUB
,&
7
a
9
,
?
~
e~
., ~
~
.,"," ~
~
?
?
~
?
?
?
?
?
Calculator
1
2
3
4
'Y
DISP
ENT EXP ENT EXP
SIN
SINH
10'11.
CHS
FIX
SUB
7
HHC
Calculator
HHC
Calculator
a
TAN
CLS
A
B
C
ATAN
ClM
b
c
d
e
X-u(O.l)
2x
eX
f
V
9
REC
MUl
h
i
5
J
3
0
DIV
l
M
N
0
6
0
P
q
Q
u
COS
1/x
TANH
M+
4
V
W
r
5
V
y'il.
w
x
0
'IT
Y
COSH
ATAN2
ADD
COT t
z
R
S
X-
LO&·l)
2
'tnOG
va
STO
MUL
Y
1
2
3
0
DIV
6
+
ACOS
x2
ATANH
T
M­
U
4
xY
COSH
ATAN2
ADD
COT
X
Y
Z
R~T
DIG
DEG/RAD
SEARCH SCI
ENTER ENTERI
PUSH/DUP
TECHNICAL NOTE: There are ways to produce a
CANCEL other than using theCANCEL key. For exam­
pie, "2nd SFT" follow by "a" produces a "space" char­
aeter. The same is true of "2nd SFT' plus any
alphabetic key not having an assigned punctuation
character for its 2nd SFT interpretation. All such
"SPACES" are equivalent to the SPACE bar
"SPACE" as far as the Scientific Calculator is con­
earned and will be considered to be CANCEL.
~
',Ii
'if,
K
P
~.
If' ,
1
2
8
9
DROP/CE
SWAP
ROLL
PICK
E
F
G
H
j
k
1
m
n
5
6
7
8
9
C1
C2
C3
C4
D
9·1
I"
w
w
APPENDIX A. REFERENCES
••
w
ft,
­
•"
(;rl"
c;. I VI
t:,ij
•
~
~
e
~
.,..,., In the construction of part of the programs in the Scientific
C!;llculator capsule, Friends Amis used algorithms from the
following references:
1. Cody, W. J. Jr., and Waite, W. SOFTWARE MANUAL
FOR THE ELEMENTARY FUNCTIONS, 1980, Prentice­
Hall, Inc.
2. Kahan, W. "Why do we need a floating-point arithmetic
standard?" Unpublished Memorandum, U. California,
Berkeley, 1981.
3. Knuth, D. E. THE ART OF COMPUTER PROGRAM­
MING, Addison- Wesley Publishing Company, 1981, p. 125
(Algorithm, Monahan et al).
~
~,
~
~
~
e:
~
e
"., .,., ., e ...,
e'
#>'
'"
~
i"
':JI
I'"
?
I"
<'
"
'::I
"
~
'"
'J1
C
,,, 'J)
'*,. I:J
r
,"'
~
~
;.
~
;;lI
~
4r
~'
r
.'", .
A·1
v
t;
~
.-
ill
i
c;, ;,
~
,.,
t;
..•
.
;p
~
APPENDIX B. USING
PERIPHERALS WITH THE
SCIENTIFIC CALCULATOR
Peripheral devices such as a video monitor, an RS-232 print­
er, or the microprinter may be used to remind you of
steps while you are in the middle of a calculation. In general,
numbers shown on the HHC display are sent to the output
peripherals you select, but arithmetic and function symbols
are not.
1. If necessary, consult the appropriate instruction manual
for each peripheral you want to use.
e
~
~
~
e
~
2. Press the HHC OFF key and
~
~
3. Connect the peripheral(s) to the HHC or to an 1/0 adaptor.
Press the HHC ON key, then the 1/0 key to get to the 1/0
menu.
t'
~
e:
IIj
e
i!'
A!t
~
e:
~
e
~
f
~
~
e
e
e
e
e
';)
';)
~
~
~
..
'4
•
(;
..
•
4. After making the appropriate 1/0 settings, exit from the 1/0
menu to the primary menu and select the SCIENTIFIC CAL­
CULATOR.
If your peripherals are already physically connected, you can
change peripheral selection and preserve the current status
of your calculations by pressing the I/O key while you are in
the Scientific Calculator. When you have completed your
selection, press the 1/0 key again to return directly to the
calculator. The 1/0 key menu responds to the standard HHC
keys on the uppermost row of the keyboard
remove the
overlay while using the 1/0 key.
Because the microprinter has a maximum capacity of 15
characters per line, numbers longer than 15 characters will
print on two lines, being split at the E. For example, ­
.123456789012E 123 will print as
1.23456789012
E-124 <3
~
""..
~
•
~
...
.-
6
~
~.
1::1-1
.
I~
I~
i.) ! .-­
.
APPENDIX C. USING THE
SCIENTIFIC CALCULATOR AS A
LIBRARY
.~
(;;, I .(;,
iil
e;:
;;i!I
.~
e;. !t
~
~,
~
~
e
I!!J
e
A)
,
.,,
~
e:
e~
~
e
e
"
"
,.
~
~
~
1lt
C;:
C
~
~
~
~
~
:;'
21
;I
;;;.
,:
;I
In this instance the mathematical routines in the scientific
calculator are the extensions to SNAP being considered. In
the following discussion, directions will be given showing
how to add functions like SIN and LOG to the SNAP vocabu­
lary. (The following discussion is not needed to implement
the library; it merely explains what is going on. Readers can
skip to the sample and copy it directly.)
SNAP has a potential vocabulary of over two thousand oper­
ations (or "words"). About two hundred are permanently
defined inside the HHC and the remaining operations can be
assigned by the programmer either by compiling his or her
own code in the HHC or by making use of library capsules
like the Scientific Calculator. All of the tags in SNAP can be
thought of as three- digit hexidecimal numbers. The first of
these three digits is the most important one, because it is
required that all tags with the same first digit must all reside
in the same area (note that there is an exception if the first
digit is zero). In other words, if you are using tags numbered
5xx, you cannot have half of them coming from one library
capsule and the other half from a different capsule.
In the HHC, the usage of tags is defined in an area of internal
RAM caUed TVECTO. It is set up as follows.
ADDRESS
3 BYTES
TVECTO
TVECTO+3 ~
~
APPLIES TO
O-PREFiX (Le.,
short tags)
1-PREFIX
iI
~
~
One of the basic concepts underlying the FORTH and SNAP
computer languages is that they behave as if they were the
machine code of an abstract computer - the FORTH Ma­
chine. By the use of tags (Le., specific numbers assigned to
individual operations), SNAP object code begins to resemble
a machine language in appearance. But unlike most ma­
chine languages, SNAP is able to redefine itself and alter its
functional capabilities considerably. For example, one appli­
cation might need advanced math and another might need
file-handling utilities.
C-1
5'
'fOO
~ n~l ('),~
{}
(11 '" ~
\1t
~ \~
w
()
E){ IT
ENDIF
1 + DUP 80 =
UNTIL
CR ." NOT FOUND"
KEY CLEAR
2+ C!
*'
BEGIN DUP FLIP &,EHTRINSIC [email protected] OR
ROMADDR &,LBUF 7,.lLEN B I GMOIJE
IDIMAGE COUNT SCALC COUNT S=
IF
80 OR
TiJECTO +
E)-(TIMAGE [email protected] 3
I.JECT I MAGE @ OiJEFi !
o
&U,UF ROMID ROMADDR - +
IDIMAGE
&Li3UF ROMIJECT ROMADDR - + == VECTIMAGE
&Li3UF ROMEXT ROMADDR - + = Dn I MAGE
STI~ING" SCIENTIFIC CALCULATOR" SCALC
HEX
GETMATH (S --- )
==
n
-.­fir
s:r CD (/)"
0. 3 ~
X
."
m
CAPSULE FOUND - RETURN
NOT FOUND
/
/
IT'S THE SCIENTIFIC CALC
ADDRESS IN TVECTO
STORE TAGTABLE ADDRESS
BEGINNING CODE FOR ROM SEARCH
lOOP THROUGH CAPSULES
NEW ROM, SAME RAM
READ NEW CA PSUlE HEADER
COMPARE CAPSULE 10 'S
/
/
/
/
/
/
/
/
X
."
m
f0 tl' "'. "" ~ "" 4J:t;. t'" t.". ~ ,~
-<::::ll»o..
1»831»
otilE~
I»
_.
CD
'9~~~
=~
-b
::0
-b
::0
I\:)
co .
0'>
+
~
l.t\tuout)tiC,lC,ltiCJGlfJ(;~.
~ ('t
(i)
c
Ul
I»
"0
0
'<
-.
I»
I
cr(1)::::l
Zo-
8'
-.
::J"'
(1)
-.1»
-(ii
(/)0
(/)0'
-
. -<li
.... (/) 0
(1)
o CD "0 en (1)
....
g:.
s:(1)(1)I::J"'
o""i3(1)~
sn(1) :;:
Q. I
(1) ::::h 0
CAPSULE NAME
(.
Sl
~
+
d
o
-i
m
m
<
-;"
<
/
~~~~~~~~~~~~~~~~~~~~~~~~
J~ ~) •.!!f)
Q.:;: ~(1)
::Oil»:;:(1)
I» _»~
~ ?'<" '"0 CD
... -;"0 Ul
m::J"'osa
_,(1) CO 0
0..- .... 0
(1) ;;;[ ~ ::::l
0=
(1)­
~:;:
N
..... a..
1»0
I»
.... CO
(1)0
s·
d~
0(1)
'Iff
-
til ~
(1).....
-;::J"'-ol»
0
(1)
O:::;;UlQ:cr
~..... 0 ':S. 5!!. (1) ~
0 0 ::::l ::::lCO-(1)
::t co ::::l ~ (/)
s:: -g (/)
g:. ~ » (/) £:l £:l
(J)3
sna.::r~(1)
CD:::;'
_"0
_ ::o(1)--(/)
()
111
I» -h 0 -;
0-h::J"'
(1)
m8 ::. -
m (/)
C
I»
::::lx
a.. I»
I
•
~,
II':
NOTE: this is more general than necessary since it is
known that ROM EXT contains 5 in the Scientific Calcula­
tor.
After GETMATH has been executed, the only question is
how to call a function like COSINE. Assume that the tag value of cosine is 525 (hex), then you would define
'"
~ e a
'
t
~
1;" ,;)
~
(1;,
~
iii
(f,'
HE>: T: COS 5 C /_1) 25 C ,_I,J T;
(in HHC Del}eloPfllent s}'stellll
or
: COS 5 C 125 C I
(in Sn;apFORTHl ;
IMMEDIATE
before you call COS. Thereafter, COS will compile properly.
Unless stated otherwise, all inputs and results are floating point numbers.
"
I!;,
d
e
e
e
~
~
t:'
~
@;
.,
.,
~
e
t: '!I
e
e
~
e
e
., ~ e.
'!)
C
~
~
~
~
,
,;:'
~
2l
,-'
'IiI"
~
~
C€ .
~
IIi!f
Result
FO<
FCMP
ADJUST.
SIGN
FLOAT
tNT
FINVERT
ATAN
ATAN2
SQRT
EXP
lOG
LN
SIN
COS
TAN
COT
U(O,1 )
XY
XY
XY
XY
X
XY
512
514
515
51C
51E
51F
520
521
522
523
524
525
526
527
528
XY .SIGN(X)xY
N
X
X
N
1/X
X
ARCTAN (X)
X
XY ARCTAN (Y/X)
X
X
lOG1Q (X)
X
LOGe (X)
X
X
SIN (X)
COS(X)
X
TAN(X)
X
X
COT(X)
ADDRX N(0,1)
529
ADDRX
TANH
SINH
COSH
ASIN
ACOS
ATANH
POWER
52A
52B
52C
52D
52E
52F
X
X
X
X
X
X
TANH(X)
SINH(X)
COSH(X)
ARCSIN(X)
ARCCOS(X)
ARCTANH(X)
530
XV
xy
X
Integer part of X
0
1.0
.5
1.570796326795
3.141592653590
X-V
X+Y
XxV
'tI'",'
N is one-word
integer, X is
floating point
reverse of float
e
~
.. The Scientific
Calculator
sets up
TVECTO
BOOl (X<O)
X BOOl (ABS[X]> Y)
,I;
'
Comment
XIV
~
i
~'
Tag In(in hex) put
500
501
503
504
505
506
507
509
50B
50C
50D
50E
50F
510
SCICALC
CAP.INIT
FIX
0.0
1.0
.5
PI/2
PI
FF+
F*
FI
'!!I
!
!It
"_II
Name
,
C-5
Address of
a-byte seed
Address of
a-byte seed
~ ~~.
~,
~\\)~~
~
CANCEL
u \) ,,) \)
UH) "
"
(t~(Il(ll
~, ~.
(\
SCIENTIFIC
CALCULATOR
"'\JUU4)t>C)~~$li
~~fl~~~~nQ~""~~~~~~
(';
t;
(!i,
Jl
l>
o
-<
m
m
~
:z:
:I:
o
C
e
»to
<)(
rZ
jJm
m"'O
<"tJ
0):1­
tJCiCf • •
~. ~l
,y
"'"
FRIENDS AMIS, INC.
~,
~
~..
~
\'W'
<it
~
~:
!l>
fi:
~
e.
The program described in this document is fumished under a license
and may be used, copied and disclosed only in accordance with the
terms of such license.
FRIENDS AMIS, INC. ("FA") EXPRESSLY DISCLAIMS THE IM­
PLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR USE FOR A PARTICULAR PURPOSE RESPECTING THE
HHC SOFlWARE PROGRAM AND MANUAL. THE PROGRAM
AND MANUAL ARE SOLD "AS IS", THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR USE FOR A PARTIC­
ULAR PURPOSE AS TO THE MEDIUM ON WHICH THE SOFT­
WARE IS RECORDED ARE LIMITED TO SIXTY (60) DAYS FROM
THE DATE OF LICENSING BY THE INITIAL USER OF THE PROD­
UCT AND ARE NOT EXTENDED TO ANY OTHER PARTY.
USER AGREES THAT ANY LIABILITY OF FA HEREUNDER, RE­
GARDLESS OF THE FORM OF ACTION, SHALL NOT EXCEED
THE LICENSE FEE PAID BY USER TO FA. FA SHALL NOT BE
LIABLE FOR INDIRECT, SPECIAL OR CONSEQUENTIAL DAM­
AGES, SUCH AS, BUT NOT LIMITED TO, LOSS OR INJURY TO
BUSINESS, PROFITS, GOODWILL, OR FOR EXEMPLARY DAM­
AGES, EVEN IF FA HAS BEEN ADVISED OF THE POSSIBILITY
OF SUCH DAMAGES.
FA will not honor any warranty when the product has been subjected
to physical abuse or used in defective or non-compatible equipment.
The user shall be solely responsible for determining the appropriate
use to be made of the program and establishing the limitations of the
program in the user's own operation.
e
An important note: Good data processing procedure dictates that
the user test the program, run and test sample sets of data, and run
the system in parallel with the system previously in use for a period of
time adequate to insure that results of operation of the computer or
programs are satisfactory.
,
~,
iir,
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement