XCALC(1) SysV XCALC(1)
NAME
xcalc - scientific calculator for X
SYNOPSIS
xcalc [-display display] [-bw pixels] [-stip] [-rv] [-rpn] [-analog] [-
geometry geometry]
DESCRIPTION
Xcalc is a scientific calculator desktop accessory that can emulate a
TI-30, an HP-10C, and a slide rule.
OPTIONS
-display displayname
This option specifies the X server to contact.
-geometry geometry
This option specifies the 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
anyway.
-fg color
This option specifies the foreground color to use.
-bg color
This option specifies the background color to use.
-bw pixels
This option specifies the border width in pixels.
-stip This option indicates that the background of the calculator
should be drawn using a stipple of the foreground and background
colors. On monochrome displays this makes for a nicer display.
-rv This option indicates that reverse video should be used.
-rpn This option indicates that Reverse Polish Notation should be
used. In this mode the calculator will look and behave like an
HP-10C. Without this flag, it will emulate a TI-30.
-analog This option indicates that a slide rule should be used.
OPERATION
Pointer Usage: Most operations are done with the Button1 (usually
leftmost button on the pointer). The only exception is that pressing the
AC key on the TI calculator with Button3 (usually on the right) will exit
the calculator.
Key Usage (Normal mode): The number keys, the +/- key, and the +, -, *,
/, and = keys all do exactly what you would expect them to. It should be
noted that the operators obey the standard rules of precedence. Thus,
entering "3+4*5=" results in "23", not "35". The parentheses can be used
to override this. For example, "(1+2+3)*(4+5+6)=" results in "6*15=90".
The non-obvious keys are detailed below.
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.
CE/C when pressed once, clears the number in the display without clearing
the state of the machine. Allows you to re-enter a number if you screw
it up. Pressing it twice clears the state, also.
AC clears everything, the display, the state, the memory, everything.
Pressing it with the right button 'turns off' the calculator, in that it
exits the program. Somewhat more equivalent to throwing the calculator
in the trash, if we were to pursue the analogy.
INV inverts the meaning of the function keys. See the individual
function keys for details.
sin computes the sine of the number in the display, as interpreted by the
current DRG mode (see DRG, below). If inverted, it computes the arcsine.
cos computes the cosine, or arccosine when inverted.
tan computes the tangent, or arctangent when inverted.
DRG changes the DRG mode, as indicated by 'DEG', 'RAD', or 'GRAD' at the
bottom of number window of the calculator. When in 'DEG' mode, numbers
in the display are taken as being degrees. In 'RAD' mode, numbers are in
radians, and in 'GRAD' mode, numbers are in gradians. When inverted, the
DRG key has the nifty feature of converting degrees to radians to
gradians and vice-versa. Example: put the calculator into 'DEG' mode,
and type "45 INV DRG". The display should now show something along the
lines of ".785398", which is 45 degrees converted to radians.
e the constant 'e'. (2.7182818...)
EE used for entering exponential numbers. For example, to enter "-2.3E-
4" you'd type "2 . 3 +/- EE 4 +/-"
log calculates the log (base 10) of the number in the display. When
inverted, it raises "10.0" to the number in the display. For example,
typing "3 INV log" should result in "1000".
ln calcuates the log (base e) of the number in the display. When
inverted, it raises "e" to the number in the display. For example,
typing "e ln" should result in "1"
y^x raises the number on the left to the power of the number on the
right. For example "2 y^x 3 =" results in "8", which is 2^3. For a
further example, "(1+2+3) y^x (1+2) =" equals "6 y^x 3" which equals
"216".
PI the constant 'pi'. (3.1415927....)
x! computes the factorial of the number in the display. The number in
the display must be an integer in the range 0-500, though, depending on
your math library, it might overflow long before that.
STO copies the number in the display to the memory location.
RCL copies the number from the memory location to the display.
SUM adds the number in the display to the number in the memory location.
EXC swaps the number in the display with the number in the memory
location.
Key Usage (RPN mode): The number keys, CHS (change sign), +, -, *, /, and
ENTR keys all do exactly what you would expect them to do. Many of the
remaining keys are the same as in normal mode. The differences are
detailed below.
<- is a backspace key that can be used while typing a number. It will
erase digits from the display.
ON clears everything, the display, the state, the memory, everything.
Pressing it with the right button 'turns off' the calculator, in that it
exits the program. Somewhat more equivalent to throwing the calculator
in the trash, if we were to pursue the analogy.
INV inverts the meaning of the function keys. This would be the "f" key
on an HP calculator, but xcalc does not have the resolution to display
multiple legends on each key. See the individual function keys for
details.
10^x raises "10.0" to the number in the top of the stack. When inverted,
it calculates the log (base 10) of the number in the display.
e^x raises "e" to the number in the top of the stack. When inverted, it
calcuates the log (base e) of the number in the display.
STO copies the number in the top of the stack to a memory location.
There are 10 memory locations. The desired memory is specified by
following this key with pressing a digit key.
RCL pushes the number from the specified memory location onto the stack.
SUM adds the number on top of the stack to the number in the specified
memory location.
x:y exchanges the numbers in the top two stack positions.
R v rolls the stack downward. When inverted, it rolls the stack upward.
blank these keys were used for programming functions on the HP11-C.
Their functionality has not been duplicated here.
KEYBOARD EQUIVALENTS
If you have the pointer in the xcalc window, you can use the keyboard to
speed entry, as almost all of the calculator keys have a keyboard
equivalent. The number keys, the operator keys, and the parentheses all
have the obvious equivalent. The less-obvious equivalents are as
follows:
n: +/- !: x!
p: PI e: EE
l: ln ^: y^x
i: INV s: sin
c: cos t: tan
d: DRG BS, DEL: CE/C ("<-" in RPN mode)
CR: ENTR q: quit
COLOR USAGE
Xcalc uses a lot of colors, given the opportunity. In the default case,
it will just use two colors (Foreground and Background) for everything.
This works out nicely. However, if you're a color fanatic you can
specify the colors used for the number keys, the operator (+-*/=) keys,
the function keys, the display, and the icon.
X DEFAULTS
The program uses the routine XGetDefault(3X) to read defaults, so its
resource names are all capitalized.
BorderWidth
Specifies the width of the border. The default is 2.
ReverseVideo
Indicates that reverse video should be used.
Stipple Indicates that the background should be stippled. The default is
``on'' for monochrome displays, and ``off'' for color displays.
Mode Specifies the default mode. Allowable values are rpn, analog.
Foreground
Specifies the default color used for borders and text.
Background
Specifies the default color used for the background.
NKeyFore, NKeyBack
Specifies the colors used for the number keys.
OKeyFore, OKeyBack
Specifies the colors used for the operator keys.
FKeyFore, FKeyBack
Specifies the colors used for the function keys.
DispFore, DispBack
Specifies the colors used for the display.
IconFore, IconBack
Specifies the colors used for the icon.
EXAMPLES
If you're running on a monochrome display, you shouldn't need any
.Xdefaults entries for xcalc. On a color display, you might want to try
the following in normal mode:
xcalc.Foreground: Black
xcalc.Background: LightSteelBlue
xcalc.NKeyFore: Black
xcalc.NKeyBack: White
xcalc.OKeyFore: Aquamarine
xcalc.OKeyBack: DarkSlateGray
xcalc.FKeyFore: White
xcalc.FKeyBack: #900
xcalc.DispFore: Yellow
xcalc.DispBack: #777
xcalc.IconFore: Red
xcalc.IconBack: White
SEE ALSO
X(1), xrdb(1)
BUGS
The calculator doesn't resize.
The slide rule and HP mode may or may not work correctly.
This application should really be implemented with the X Toolkit. It
would make a very good example of a compound widget.
COPYRIGHT
Copyright 1988, Massachusetts Institute of Technology.
See X(1) for a full statement of rights and permissions.
AUTHORS
John Bradley, University of Pennsylvania
Mark Rosenstein, MIT Project Athena