Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ hpcalc(1) — sys5 — Apollo

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

X(1)

xrdb(1)

HPCALC(1)                            SysV                            HPCALC(1)



NAME
     hpcalc - scientific calculator for X

SYNOPSIS
     hpcalc <options>

DESCRIPTION
     hpcalc is a scientific calculator desktop accessory that can emulate a
     postfix (Reverse Polish Notation) calculator, or optionally an infix
     (ARITHmetic operating system) calculator.

OPTIONS
     -display displayname
              This option specifies the X server to contact.

     -geometry geometry
              Size and placement of the top level window.  By default, the
              minimum size will be used.  Note that your window manager may
              require you to place it explicitly.

     -fg color
              Foreground color to use.

     -bg color
              Background color to use.

     -bw pixels
              Specifies the border width in pixels.

     -stip    Indicates that the background of the calculator should be drawn
              using a stipple of the foreground and background colors.  On
              monochrome displays this makes a nicer display.

     -rv      Use reverse video.

     -postfix Use the postfix calculator mode, often called rpn mode.  This is
              the default mode.

     -rpn     This option is the same as -postfix.

     -infix   Use the infix calculator mode, often called the arithmetic mode.
              Without this flag, it will emulate the postfix mode calculator.

     -arith   This option is the same as -infix.

POINTER USAGE
     Most operations are done with the left mouse button.  The only exception
     is that you can exit the calculator by pressing the [CLR] key on the rpn
     mode calculator, or the [AC] key on the arithmetic mode calculator with
     the right mouse button.


GENERAL OPERATION
     The rpn mode calculator operates around its four working stack registers
     called x, y, z, and t. The x stack register is special in that it
     contains the number which is shown in the display, and is often called
     the DISPLAY register.  In addition the rpn calculator has ten data
     storage registers, 0 to 9. You can move numbers between the four stack
     registers with the [x:y] and [R v] keys.  You can move numbers between
     the display and the data registers with the [STO] n and [RCL] n keys.

     Stack register specific functions such as e^x or y^x operate on the
     specified registers in the indicated way.  Otherwise, normal two operand
     functions such as +, -, *, /, operate on the x and y registers in the
     order y+x, y-x, y*x, y/x.

     With the rpn mode calculator you type the two numbers or operands
     followed by the math operation.  Thus to divide 45 by 3.5 you execute the
     key sequence [4] [5] [ENTR] [3] [.] [5] [/].  Complex calculations can be
     easily chained in this mode.  The calculation (((5+9)/4)+7)*12 is
     computed by the key sequence [5] [ENTR] [9] [+] [4] [/] [7] [+] [1] [2]
     [*].


     The arithmetic mode calculator is like the common four function
     calculator.  It has one data storage register, and numbers are moved
     between this register and the display with the [STO] and [RCL] keys.

     The number keys [0]..[9], and the [+], [-], [*], [/], [(], [)] keys are
     used to enter arithmetic expressions and the [=] key causes the
     expression to be evaluated.  It should be noted that the operators obey
     the standard rules of precedence.  Thus, entering "3+4*5=" results in
     "23", not "35".  Parentheses can be used to override this.  For example,
     (1+2+3)*(4+5+6)= results in 6*15=90.


DETAILED OPERATION
     hpcalc closely emulates the operation of the HP-10C or TI-30. The details
     of its operation are listed below.

     [<-]     is the rpn mode backspace key.  It is used to erase digits from
              the display while entering a number.

     [CLR]    is the rpn mode calculator clear key.  It clears only the
              display.  Pressing it with the right mouse button turns off the
              calculator, terminating the program.

     [AC]     is the arithmetic mode calculator power-on clear key.  It clears
              everything, the display, the [DRG] state, the data storage
              memory, everything.  Pressing it with the right mouse button
              turns off the calculator, terminating the program.

     [CE/C]   is the arithmetic mode calculator clear display key.  When
              pressed once, it clears only the number in the display without
              clearing the state of the machine.  This allows you to correct
              an entry if you make an error.  Pressing it twice also clears
              the state.

     [CHS]    is the rpn mode calculator key used to change the sign of the
              number in the display or the sign of its exponent.  For example,
              the key sequence [2] [.] [3] [4] [CHS] [EEX] [4] [CHS] enters
              the number -2.34E-4, which is the exponential form of -0.000234.

     [+/-]    is the arithmetic mode calculator key used to change the sign of
              the number in the display or the sign of its exponent.  For
              example, the key sequence [2] [.] [3] [4] [+/-] [EE] [4] [+/-]
              enters the number -2.34E-4, which is the exponential form of -
              0.000234.

     [INV]    inverts the meaning of the function keys, eg. [INV] [sin]
              computes the arcsine of the number in the DISPLAY. See the
              individual function keys for details.

     [x:y]    is the rpn mode calculator function which exchanges the number
              in the x or DISPLAY register with the number in the y register.

     [R v]    is the rpn mode calculator function which rolls the four stack
              registers, x, y, z, t, downward so that x=y, y=z, z=t, t=x. Its
              [INV] function rolls the stack upward so that y=x, z=y, t=z,
              x=t.

     [STO] n  is the rpn mode form of the store data function. It copies the
              number in the DISPLAY to the n-th data storage memory location.
              There are 10 of these memory locations for the rpn mode
              calculator, named 0 to 9.

     [STO]    is the arithmetic mode form of the store data function. It
              copies the number in the DISPLAY to the one data storage memory
              location.

     [RCL] n  is the rpn mode calculator form of the get data function. It
              copies the number in the n-th data storage memory location to
              the DISPLAY. There are 10 of these memory locations for the rpn
              mode calculator, named 0 to 9.

     [RCL]    is the arithmetic mode calculator form of the get data function.
              It copies the number in the data storage memory location to the
              DISPLAY.

     [EXC]    is the arithmetic mode calculator exchange function.  It swaps
              the number in the display with the number in the one data
              storage memory location.

     [SUM] n  is the rpn mode calculator form of the sum function. It adds the
              number in the DISPLAY to the number in the n-th data storage
              memory location and saves the result in the n-th data storage
              memory location.

     [SUM]    is the arithmetic mode calculator form of the sum function.  It
              adds the number in the DISPLAY to the number in the one data
              storage memory location and saves the result in the data storage
              memory location.

     [1/x]    replaces the number in the DISPLAY with its reciprocal.

     [x^2]    squares the number in the DISPLAY.

     [SQRT]   takes the square root of the number in the DISPLAY.

     [PI]     enters the constant pi = 3.1415927....

     [DRG]    changes the DRG mode, as indicated by DEG, RAD, or GRAD at the
              bottom of the display. When in DEG mode, numbers in the display
              are in degrees.  In the RAD mode, numbers are in radians, and in
              the GRAD mode, numbers are in gradians.  The [INV] DRG function
              is a units conversion utility between the different types of
              units, ie. converts degrees to radians, radians to gradians, and
              gradians to degrees.  For example, put the calculator into DEG
              mode.   Then the key sequence [4] [5] [INV] [DRG], converts 45
              degrees to 0.785398 radians with the display showing the units
              to be RAD. Continuing with [INV] [DRG] produces 50 GRAD, and
              finally [INV] [DRG] produces the original 45 DEG.

     [sin]    computes the sine of the number in the DISPLAY, as interpreted
              by the current DRG mode.  Its [INV] function computes the
              arcsine.

     [cos]    computes the cosine of the number in the DISPLAY, as interpreted
              by the current DRG mode.  Its [INV] function computes the
              arccosine.

     [tan]    computes the tangent of the number in the DISPLAY, as
              interpreted by the current DRG mode.  Its [INV] function
              computes the arctangent.

     [EEX]    is the rpn mode calculator key used for entering the exponential
              form of numbers.  For example, the key sequence [2] [.] [3] [4]
              [EEX] [CHS] enters the exponential form 2.34 E-4 of the number
              0.000234.

     [EE]     is the arithmetic mode calculator key used for entering the
              exponential form of numbers.  For example, the key sequence [2]
              [.] [3] [4] [EE] [+/-] enters the exponential form 2.34 E-4 of
              the number 0.000234.

     [10^x]   raises the base 10 to the number in the DISPLAY. Its [INV]
              function calculates the base 10 logarithm of the number in the
              DISPLAY.

     [log]    calculates the base 10 logarithm of the number in the DISPLAY.
              Its [INV] function raises 10 to the power of the number in the
              DISPLAY. For example, the key sequence [3] [INV] [log] produces
              the result 1000.

     [e]      enters the constant e = 2.7182818....

     [e^x]    raises the base e to the number in the DISPLAY. Its [INV]
              function calculates the natural logarithm of the number in the
              DISPLAY.

     [ln]     calculates the base e logarithm of the number in the DISPLAY.
              Its [INV] function raises e to the power of the number in the
              DISPLAY. For example, the key sequence [3] [INV] [ln] produces
              the result 20.08553.... The key sequence [e] [ln] produces the
              result 1.

     [y^x]    raises the number in the y register to the power of the number
              in the DISPLAY. For example, the key sequence [2] [ENTR] [3]
              [y^x] on the rpn mode calculator produces the result 8. For the
              arithmetic mode calculator, the key sequence [2] [y^x] [3] [=]
              produces the same result.

     [x!]     computes the factorial of the number in the DISPLAY. The number
              must be an integer in the range 0-170. Numbers larger than 170
              cause an overflow error.


KEYBOARD EQUIVALENTS
     If you have the pointer in the hpcalc window, you can use the keyboard to
     speed entry by using the keyboard equivalents to the calculator keys.
     The number keys 0 to 9, the operator keys +-*/=, and the parentheses all
     have identical keyboard equivalents.  Other keyboard equivalents are as
     follows:

     [q]         quits the calculator, terminating it.

     [BS], [DEL] equals the [<-] or [CE/C] key.

     [CR]        equals the [ENTR] key.

     [n]         equals the [CHS] or [+/-] key.

     [i]         equals the [INV] key.

     [e]         equals the [EEX] or [EE] key.

     [p]         equals the [PI] key.

     [d]         equals the [DRG] key.
     [s]         equals the [sin] key.

     [c]         equals the [cos] key.

     [t]         equals the [tan] key.

     [l]         equals the [ln] key.

     [^]         equals the [y^x] key.

     [!]         equals the [x!] key.


COLOR USAGE
     In the default case, hpalc uses just two colors, Foreground and
     Background for everything.  This works well and is very adequate for most
     cases.

     However, hpcalc can use many colors.  You can specify individually, the
     colors used for the number keys, the operator keys, the function keys,
     the display, and the icon.


X DEFAULTS
     The program uses the following resource names:

     BorderWidth
             Sets the border width.  The default is 2.

     ReverseVideo
             Use reverse video.

     Stipple Indicates that the background should be stippled, a blending of
             background and foreground colors to give better contrast on
             monochrome displays.  The default is ``off'' for color displays,
             and should be turned ``on''  if you have a monochrome display.

     Mode    Sets the default calculator mode, either postfix or infix.
             Allowable values are postfix, or rpn for the postfix mode and
             infix, or arith for the arithmetic mode.  If no mode is specified
             hpcalc will come up in the postfix mode as a default.

     Foreground
             Color used for borders and text.

     Background
             Color used for the background.

     NKeyFore, NKeyBack
             Colors used for the number keys.

     OKeyFore, OKeyBack
             Colors used for the operator keys.

     FKeyFore, FKeyBack
             Colors used for the function keys.

     DispFore, DispBack
             Colors used for the display.

     IconFore, IconBack
             Colors used by the icon.


EXAMPLE
     If you're running on a monochrome display, you don't need any .Xdefaults
     entries for hpcalc. On a color display, the following .Xdefaults work
     well:

     xcalc.Foreground:         White

     xcalc.Background:         SlateBlue

     xcalc.NKeyFore:           White

     xcalc.NKeyBack:           DarkSlateBlue

     xcalc.OKeyFore:           White

     xcalc.OKeyBack:           DarkSlateBlue

     xcalc.FKeyFore:           White

     xcalc.FKeyBack:           DarkSlateBlue

     xcalc.DispFore:           White

     xcalc.DispBack:           DarkSlateBlue

     xcalc.IconFore:           Red

     xcalc.IconBack:           White

     xcalc.Stipple:            Off

     xcalc.Mode:               postfix

     xcalc.Geometry:           =-8-8

     xcalc.DisplayFont:        hp8.10x20b

     xcalc.KeyFont:            hp8.8x16b

     xcalc.FlagFont:           hp8.6x13


SEE ALSO
     X(1), xrdb(1)


BUGS
     The calculator doesn't resize.


COPYRIGHT
     Copyright 1988, Massachusetts Institute of Technology.
     See X(1) for a full statement of rights and permissions.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026