home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d1xx
/
d130
/
hp.lha
/
Hp
/
hp.doc
< prev
next >
Wrap
Text File
|
1988-03-13
|
12KB
|
218 lines
-----------------------------------------
/ \
| h |
| h |
| h |
| h |
| h h h p p p |
| h h p p |
| h h p p |
| h h p p p p |
| p |
| p |
| p |
\ /
-----------------------------------------
Version 1.0
March 1987
Steve Bonner
I. Introduction.
"hp" is a public domain scientific calculator for the Amiga.
It uses postfix notation (sometimes referred to as "RPN") and
supports calculations with binary, octal, decimal, hex, float and
complex numbers. Since complex numbers possess both a real and an
imaginary component, the calculator display shows two numbers at
a time. This way the entire complex number may be seen at a
glance. As with popular postfix notation calculators, the last
four numbers entered are stored on a "stack". With "hp", the
two most recently-entered numbers (referred to as "x" and "y")
are always visible. The other values ("z" and "t") scroll off
the top of the display, but are still available for use. Thus,
four float or integer values may be pushed onto the stack at
one time, or two complex numbers.
II. Getting started.
hp can be invoked either by typing "hp" in CLI or by selecting
its logo from Workbench. (Of course, you may also type
"run hp" from CLI if you anticipate a need for multitasking.)
hp does not use a Workbench window, but instead opens its own
screen. To make the hp screen appear in front of or behind the
Workbench screen, depress the left "Amiga" key (the solid red "A")
along with the "m" or "n" key, respectively. When the program
is initially invoked, the default calculator settings will always
be in effect. These are: float mode, angular measure in degrees
and print tracing turned off. The arithmetic mode and angular
units in effect will always be highlighted in yellow. The "print"
key toggles print tracing on and off. When turned on, "print"
causes every calculator input, command and result to be sent to
the printer.
III. Arithmetic modes.
Six types of numbers may be used when carrying out calculations
with hp: binary, octal, decimal, hex, float and complex. The
calculator may be in only one of these modes at a time, and all
elements of the stack will be interpreted as numbers of this
type. Note that if complex (CPX) mode is selected, the unary
operations (affecting a single number, such as sine or logarithm)
update both x and y registers, while the binary operations (e.g.,
addition, subtraction ) affect all four stack registers. If
the calculator is switched to or from integer mode (e.g., from
octal to complex or from float to hex) the stack is cleared.
Between the integer modes, the stack contents are preserved,
and the x and y registers are displayed accordingly. Similarly,
switching between float and complex does not affect the stack.
(It does, however, affect the way the stack contents are
interpreted.)
Binary mode. All integers used by hp are 32-bit signed quantities.
Negation is always by 2's complement. Thus, the binary
representation of -1 is a string of 32 ones.
Octal mode. In octal mode, bits are represented in groups of three.
Since the fixed wordsize of 32 is not divisible by
3, the two highest-order bits are always grouped by
themselves. Thus, -1 in octal is: 37777777777
Decimal mode. This is the only integer mode which does not depict
numbers as groupings of bits. For this reason,
negative values are displayed in the traditional
manner, with a leading minus sign.
Hex mode. These are numbers base 16. As is customary, the
additional "digits" A through F are provided.
Float mode. Floating-point numbers are always displayed in
scientific notation.
Complex mode. Complex numbers require two registers for storage.
The real part of the number is always entered first,
followed by the imaginary part. Thus, to multiply
(3 + 5i) by (2 - i), the following keystrokes would
be used: 3 enter 5 enter 2 enter 1 chs x.
Note that in complex mode, all numbers-- even complex
numbers which are purely real or imaginary-- consist
of two distinct parts. So, to multiply
(3 + 5i) by the real number 2, the following would
be necessary: 3 enter 5 enter 2 enter 0 x.
IV. User interface.
The hp "keyboard" is designed to look and function as a hand-held
calculator. All keys are selected by use of the mouse. The left
mouse button is used to click on calculator keys. (The right mouse
button is not used by hp.) The color of the hp display screen
can be set to any one of 4096 colors by clicking the red, green and
blue keys on the upper right of the calculator.
Depending on the arithmetic mode of the calculator, not all function
keys will be active at any one time. For example, the trig functions
are not available in integer mode. This is simply because the sine
(for example) of a number would always yield a number between plus
and minus 1, which would in turn always be truncated to plus one,
minus one or zero. Similarly, the key for the digit "8" is not
active in octal mode, because octal numbers consist entirely of
digits between 0 and 7. If an inactive key is selected, the hp
display will briefly flash an orange color to indicate an invalid
input.
If a numerical error occurs during calculations, the hp display is
cleared an an appropriate message is issued. The error messages
which may arise are: domain error, singularity, overflow, underflow
and loss of digits. The error message display can be acknowledged
by clicking the left mouse button anywhere on the screen. An
error while in integer or float mode will cause the contents of
the x register to be reset to zero. For complex numbers, both
x and y are cleared.
V. Stack operations.
Five of the blue keys along the bottom of the screen perform
operations on the stack. RCLz and RCLt cause the contents of
register z (or t) to be "pushed" onto the stack. As always,
a consequence of pushing a number is that the old contents of
register t "fall off" of the stack, and are lost. Note that
these functions do not move register z or t into x, but instead
copy into x. So after a RCLz, the contents of registers x and
t will be the same. The LastX function recalls the last number
explicitly entered by the user. Computed values which happen to
have previously resided in x are not obtainable through LastX.
The key labelled "x<>y" (sometimes referred to as "swap")
interchanges the values in the x and y registers. The "drop"
key removes (i.e., "pops") the value of x from the top of the
stack. The three remaining stack values "move down." When
this happens, the value of t is automatically set to zero.
VI. The printer.
As mentioned above, outputs can be sent to the printer by
selecting the "Print" key in the lower left of the screen.
In order to allow for potentially long binary numbers, the
printer is commanded to go into "condensed" print mode.
Most dot-matrix printers have some variation of this feature.
If your printer does not have this capability, the command may
be ignored, in which case the text lines would be truncated
(unless, of course, you have a wide carriage with suitable
forms in place).
The printer you use may be connected either in parallel or
serially, since hp simply sends outputs to the PRT: device,
which then forwards the data to the appropriate printer-
specific device driver.
VII. Store and Recall of data.
hp provides 32 registers in which data may be stored. Sixteen
of these are used for integers and sixteen are used for floats.
Each set of registers is numbered 0 through F. To store a
number, select STO. The underscore prompt will appear: STO _.
At this point, select a digit key from 0 through F. (Similarly
for RCL) The register written to will depend on the arithmetic
mode: integer or float. For example, if you store the floating
point number pi in register 5 and then switch to octal and
recall register 5, you will see the last number stored in integer
register 5-- not pi. But when you return to float (or complex)
mode, recalling register 5 will display pi once again.
VIII. Complex numbers.
Many functions defined for complex numbers are multiple-valued
(i.e., are not really functions at all). An example of such
a function is the logarithm. For real numbers, it is possible
to take logarithms only at positive values. But for complex
numbers, any number other than zero has a logarithm. In fact,
each such number has infinitely many logarithm values. A
familiar analogy to this would be the real-valued arcsine curve.
Arcsine becomes a true function only when we specify which one
of infinitely many values it is to assume. (The domain for
arcsine is normally taken as [-pi/2, pi/2] .) Thus, when one
of the logarithms is selected (log, lg2 or ln) while in complex
mode, hp will display a "principal value" of the function.
For a discussion of complex numbers and a derivation of the
algorithms used by hp, see (for example) Complex Variables and
Applications, by Churchill, Brown and Verhey. If you are
interested in how complex functions map one region of the plane
into another, see Dictionary of Conformal Representations, by
H. Kober (1957, Dover Publications). This latter book is
thoroughly illustrated and is highly recommended for anyone with
an interest in complex numbers.
IX. Program note.
hp is intended solely for free distribution as public domain
software, and is not to be sold. If you like hp, please give
a copy to a friend.