NAME
calctool - a desktop calculator
SYNOPSIS
calctool [ -2 ] [ -3 ] [ -a accuracy ] [ -c ] [ -l ] [ -m ]
[ -name app-name ] [ -r ] [ -v ] [ -? ]
[ -Wn ] [ +Wn ]
DESCRIPTION
calctool is a desktop calculator. It has been designed to be
used with either the mouse or the keyboard. It is visually
similar to a lot of hand-held calculators. There are finan-
cial, logical and scientific modes. Similar operations are
color coded on color workstations. Some of the calculator
keys have menu marks. This indicates that there is a menu
associated with that key. Each key is discussed in more
detail below.
One of the most important things to remember about calctool
is that calculations are performed from left to right, with
no arithmetic precedence. If you need arithmetic precedence,
then you should use parentheses (see below).
Internal arithmetic is now done with multi-precision float-
ing point numbers. Accuracy can be adjusted from zero to
nine numeric places in fixed notation, but numbers can be
displayed in engineering and scientific notation as well.
The calculator reverts to scientific notation when the
number is larger than the display would allow in fixed nota-
tion. The base of operation can be changed between binary,
octal, decimal and hexadecimal. Numbers are initially
displayed in fixed notation to two numeric places, in the
decimal base.
You can use the Copy and Paste functions in conjunction with
the numeric display to store or retrieve characters from the
text shelf. You can also remove the last digit entered, and
the whole display can be cleared.
There are ten memory registers. Numbers can be stored or
retrieved in these locations, and arithmetic can be per-
formed upon register contents.
The display windows contains the current numerical value
plus the current base and trigonometric type. There are also
indicators which show if the hyperbolic and inverse function
switches are set, and which numerical mode is currently in
operation. If an operation needing more than one numerical
input is partially complete, the operation is also displayed
in this window as a reminder.
On startup, calctool will use several X resources. These are
listed in detail in the resources section of these manual
pages.
If you press MENU in the calctool window, and you aren't
over a calculator key which has a menu associated with it,
then a floating menu will appear, from which you can bring
up a property sheet. Hitting the Props function key has the
same effect.
From this property sheet, you can modify several properties
of the calculator. Each calculator button can have either a
2D or a 3D look, the keys can be in either monochrome or
color (assuming you are using a color screen), and the but-
tons can be set to give either a "left-handed" or a "right-
handed" appearance.
Context sensitive help is also available. Position the mouse
cursor over the item you need help with, and press the Help
key. A popup will be displayed giving detailed information
on this facility.
On startup, calctool will look for a .calctoolrc file in the
users' home directory. This file allows the user to define
personal constant and function definitions, plus setup the
initial values for the ten memory registers. It then looks
for a .calctoolrc file in the current directory, and if
present, uses the contents of this file in place of any pre-
viously defined values.
With the .calctoolrc file, there are currently four valid
record types. These are comments, constant and function
definitions and initial memory register values.
Lines starting with a '#' are treated as comments and
ignored.
Lines starting with 'c' or 'C' in the first column are
definitions for constants. The cC is followed by a digit in
the range 0-9, then a space. This is followed by a number
in fixed or scientific notation. Following this is an
optional comment, which if found, will be used in the popup
menu for the constants. If the comment is present, then
there must be at least one space between this and the
preceding number.
Lines starting with 'f' or 'F' in the first column are
definitions for functions. The fF is followed by a digit in
the range 0-9, then a space. This is followed by a function
definition. Following this is an optional comment, which if
found, will be used in the popup menu for the functions. If
the comment is present, then there must be at least one
space between this and the preceding function definition.
Lines starting with 'r' or 'R' in the first column are
definitions for the initial contents of the memory regis-
ters. The rR is followed by a digit in the range 0-9, then a
space. This is followed by a number in fixed or scientific
notation. The rest of the line is ignored.
All other lines are ignored. There should be no embedded
spaces in the function definitions. Whenever a backslash is
found, this and the following character signify a control
character, for example \g would be ASCII 7.
OPTIONS
-2 On a color screen, start calctool with a 2D look. This
is the default.
-3 On a color screen, start calctool with a 3D look.
-a accuracy
Initial number of digits displayed after the numeric
point. This value must be in the range 0 to 9. The
default is two numeric places.
-c Display in color, assuming this is a color screen.
-l Start up a "left-handed" version of the calctool pro-
gram.
-m Always display in monochrome, even on a color screen.
-name app-name
This option specifies the application name under which
resources are to be obtained, rather than the default
executable file name. app-name should not contain
``.'' or ``*'' characters.
-r Start up a "right-handed" version of the calctool pro-
gram. This is the default.
-v Show the version number and the usage message of this
release of the calctool program.
-? Show the version number and the usage message of this
release of the calctool program. Note that the ? char-
acter must be escaped if using csh(1).
-Wn Start calctool with no title line.
+Wn Start calctool with a title line present.
RESOURCES
On startup, calctool uses the following resources:
Resource: deskset.calctool.accuracy
Values: Accuracy value (numeric)
Description The number of of digits displayed after the
numeric point. This value must be in the
range 0 to 9.
Resource: deskset.calctool.base
Values: Numeric Base (string)
Description The initial numeric base. Valid values are
binary, octal, decimal and hexadecimal.
Resource: deskset.calctool.display
Values: Display mode (string)
Description The initial display mode. Valid values are
engineering, fixed-point and scientific.
Resource: deskset.calctool.mode
Values: Mode (string)
Description The initial calculator mode. Valid values are
basic, financial, logical and scientific.
Resource: deskset.calctool.mono
Values: True, False (False)
Description Whether the calculator should start in mono-
chrome. Color is obviously only allowed on
screens that support it.
Resource: deskset.calctool.beep
Values: True, False (True)
Description Indicates whether a beep should sound in the
event of an error (such as invalid input, or
if the display needs to be cleared).
Resource: deskset.calctool.showRegisters
Values: True, False (True)
Description Whether the memory register window is ini-
tially displayed.
Resource: deskset.calctool.trigType
Values: Trig. type (string)
Description The initial trigonometric type. Valid values
are degrees, grads and radians.
Resource: deskset.calctool.rightHanded
Values: True, False (True)
Description Whether the calculator is started with a
"right-handed" display style.
Resource: deskset.calctool.3dLook
Values: True, False (True)
Description If the display is color, whether each calcu-
lator button has a pseudo 3D appearance.
Resource: deskset.calctool.hasTitle
Values: True, False (True)
Description Indicates whether the calctool window has a
title line.
Resource: deskset.calctool.buttonFont
Values: Font name string
Description The name of the font used to display all but-
ton labels, irrespective of the current size
and scale of calctool.
Resource: deskset.calctool.modeFont
Values: Font name string
Description The name of the font used to display the
various mode labels, irrespective of the
current size and scale of calctool.
Resource: deskset.calctool.memoryFont
Values: Font name string
Description The name of the font used to display the
memory register values, irrespective of the
current size and scale of calctool.
Resource: deskset.calctool.displayFont
Values: Font name string
Description The name of the font used to show the current
display value, irrespective of the current
size and scale of calctool.
Resource: deskset.calctool.decDigitColor
Values: Color name string or hexadecimal color
specification string
Description The color of the buttons containing the
decimal digits 0 - 9 and the numeric point on
the main panel.
Resource: deskset.calctool.hexDigitColor
Values: Color name string or hexadecimal color
specification string
Description The color of the buttons containing the hexa-
decimal digits A - F on the main panel.
Resource: deskset.calctool.arithOpColor
Values: Color name string or hexadecimal color
specification string
Description The color of the arithmetic operator buttons
on the main panel.
Resource: deskset.calctool.adjustColor
Values: Color name string or hexadecimal color
specification string
Description The color of the Bsp and Clr buttons on the
main panel.
Resource: deskset.calctool.portionColor
Values: Color name string or hexadecimal color
specification string
Description The color of the Abs, Chs, Frac and Int but-
tons on the main panel.
Resource: deskset.calctool.functionColor
Values: Color name string or hexadecimal color
specification string
Description The color of various function buttons on the
main panel. These are Acc, Con, Exch, Fun,
Keys, Mem, Quit, Rcl and Sto.
Resource: deskset.calctool.mainModeColor
Values: Color name string or hexadecimal color
specification string
Description The color of the three mode buttons on the
main panel. These are Base, Disp and Mode.
Resource: deskset.calctool.portionLogicalColor
Values: Color name string or hexadecimal color
specification string
Description The color of the logical buttons in the mode
panel that do shift operations or take a por-
tion of the result. These are <, >, &16 and
&32.
Resource: deskset.calctool.bitLogicalColor
Values: Color name string or hexadecimal color
specification string
Description The color of the bitwise logical operator
buttons in the mode panel. These are And,
Not, Or, Xnor and Xor.
Resource: deskset.calctool.finColor
Values: Color name string or hexadecimal color
specification string
Description The color of the financial buttons in the
mode panel.
Resource: deskset.calctool.trigModeColor
Values: Color name string or hexadecimal color
specification string
Description The color of the trigonometrical mode buttons
in the mode panel. These are Hyp, Inv and
Trig.
Resource: deskset.calctool.trigColor
Values: Color name string or hexadecimal color
specification string
Description The color of the trigonometrical buttons in
the mode panel. These are Cos, Sin and Tan.
Resource: deskset.calctool.sciColor
Values: Color name string or hexadecimal color
specification string
Description The color of the scientific buttons in the
mode panel. These are e^x, 10^x, y^x, x!, Ln,
Log and Rand.
Resource: deskset.calctool.backgroundColor
Values: Color name string or hexadecimal color
specification string
Description The color of the background area for the cal-
culator buttons in the main and mode panels.
Resource: deskset.calctool.displayColor
Values: Color name string or hexadecimal color
specification string
Description The color of the numerical display area in
the main panel.
Resource: deskset.calctool.memRegisterColor
Values: Color name string or hexadecimal color
specification string
Description The background color in the memory register
window.
Resource: deskset.calctool.textColor
Values: Color name string or hexadecimal color
specification string
Description The color of all text. This includes the
numerical display, the button labels and the
contents of the memory register window.
CALCULATOR BUTTONS
This section describes the calculator keys present in the
main calctool window. Apart from this basic mode, calctool
has three other modes, and the keys associated each each of
these modes are described in separate sections below.
Keyboard equivalents appear in the square brackets. Note
that '^' followed by a letter indicates that the Control key
and this key should be pressed together.
Numerical Keys [ 0-9 a-f . = <Return> ].
Enter a digit (decimal digits 0-9 or hexadecimal digits A-F)
into the display. The '.' character acts as the numeric
point, and '=' (or Return) is used to complete numerical
entry.
Upto forty digits may be entered.
Arithmetical Operations [ + - x * / ].
Perform an arithmetical operation using the previous entry
and the next entry as operands. Addition, subtraction, mul-
tiplication and division are denoted by the characters '+',
'-', 'x' and '/' respectively ('*' is also synonymous with
multiplication).
Number Manipulation Operators.
Int [ ^i ] Return the integer portion of the current
entry.
Frac [ ^f ] Return the fractional portion of the
current entry.
Abs [ ^u ] Return the absolute value of the current
entry.
+/- [ C ] Change the arithmetic sign of the current
entry.
1/x [ r ] Return the value of 1 divided by the
current entry.
x^2 [ @ ] Return the square of the current entry.
% [ % ] Perform a percentage calculation using the
last entry and the next entry.
Sqrt [ s ] Perform a square root operation on the
current entry.
Asc [ ^a ] If Asc is selected with the mouse, then a
separate window is displayed which allows
you to enter any character. The ASCII
value of this character is then displayed
in the current base. If this option is
selected via the keyboard, then you don't
get a special window displayed.
Menu Operations.
Each of these operations has a popup menu associated with
it. This menu can be displayed using the MENU mouse button,
and a selection made. You can select the default item from
the menu using the SELECT mouse button.
It is also possible to use just the keyboard to achieve the
same results. The first keyboard value selects the menu
operation; the second keyboard character selects the new
value for this operation. Unlike the menu facility available
with the mouse, there is no visual feedback on what choices
are available to you, so the user has to know what item they
wish to select.
Base [ B ] Change the base that calculations are
displayed in. The available choices are
binary [ b ], octal [ o ], decimal [ d ]
and hexadecimal [ h ]. Digits that are
inappropriate for a particular base selec-
tion are greyed out in the main calctool
window.
Disp [ D ] Change the numerical display mode. The
choices are engineering [ e ], fixed point
[ f ], and scientific [ s ] notation.
Mode [ M ] Change the calculator mode. By default,
calctool is in basic mode, and just the
keys on the main calctool window are visi-
ble. There are also three other modes;
financial [ f ], logical [ l ] and scien-
tific [ s ]. Selection of one of these
modes will display an extra window with
more keys. These special operations are
described in more detail in the sections
below.
Acc [ A ] Set the display accuracy. Between 0 and 9
[ 0-9 ] significant digits can be
displayed.
Con [ # ] Retrieve and display a constant value.
There are ten constant values [ 0-9 ], and
each one has a default value which can be
overridden by entries in the users .calc-
toolrc file. The ten default values are:
0 0.621 kms per hour / miles
per hour.
1 1.41421 square root of 2.
2 2.71828 e.
3 3.14159 pi.
4 2.54 cms / inch.
5 57.29578 degrees in a radian.
6 1048576.0 2 to the power of 20.
7 0.0353 gms / oz.
8 0.948 kilojoules / British
thermals.
9 0.0610 cubic cms / cubic
inches.
Fun [ F ] Retrieve and execute a function expres-
sion. There are ten function definitions [
0-9 ]. These are setup with entries in the
users .calctoolrc file.
Rcl [ R ] Retrieve memory register value. There are
ten memory registers [ 0-9 ].
Sto [ S ] Store value in memory register. There are
ten memory registers [ 0-9 ]. The regis-
ter number may be preceded by an arith-
metic operation (addition, subtraction,
multiplication or division), in which case
the specified operation is carried out
between the displayed entry and the value
currently in the selected memory register,
and the result is placed in the memory
register.
Exch [ X ] Exchange the current display with the con-
tents of a memory register. There are ten
memory registers [ 0-9 ].
Other Operations.
Clr [ Delete ] Clear the calculator display.
Bsp [ Back Space ]
Remove the rightmost character of the
current entry, and recalculate the
displayed value.
( and ) [ ( and ) ]
Parentheses. Allow precedence with arith-
metic calculations. Note that parentheses
can be nested to any level, and calctool
provides a visual feedback of what is
being typed in, in the calculator display.
The calculation doesn't take place until
the last parenthesis is matched, then the
display is updated with the new result.
Exp [ E ] This is used to allow numbers to be
entered in scientific notation. The
mantissa should be initially entered, then
the Exp key selected. The exponent is then
entered. If no numerical input had
occurred when the Exp key was selected,
then a mantissa of 1.0 is assumed.
Keys [ k ] Toggle the labels on the calctool buttons
between the mouse and keyboard
equivalents.
Mem [ m ] Display the window with the ten memory
register values. These values are
displayed in the current base to the
current degree of accuracy using the
current numerical display notation.
Quit [ q or Q ] Exit without user verification.
FINANCIAL MODE
An example of how to use each of these financial calcula-
tions, is available via the context sensitive help facility.
Ctrm [ ^t ] Compounding term. Computes the number of
compounding periods it will take an
investment of present value pv to grow to
a future value of fv, earning a fixed
interest rate int per compunding period.
Memory register usage:
Register 0 int (periodic interest
rate).
Register 1 fv (future value).
Register 2 pv (present value).
Ddb [ ^d ] Double-declining depreciation. Computes
the depreciation allowance on an asset for
a specified period of time, using the
double-declining balance method.
Memory register usage:
Register 0 cost (amount paid for
asset).
Register 1 salvage (value of asset
at end of life).
Register 2 life (useful life of the
asset).
Register 3 period (time period for
depreciation allowance).
Fv [ v ] Future value. This calculation determines
the future value of an investment. It
computes the future value based on a
series of equal payments, each of amount
pmt, earning periodic interest rate int,
over the number of payment periods in
term.
Memory register usage:
Register 0 pmt (periodic payment).
Register 1 int (periodic interest
rate).
Register 2 n (number of periods).
Pmt [ P ] Periodic payment. Computes the amount of
the periodic payment of a loan. Most
installment loans are computed like ordi-
nary annuities, in that payments are made
at the end of each payment period.
Memory register usage:
Register 0 prin (principal).
Register 1 int (periodic interest
rate).
Register 2 n (term).
Pv [ p ] Present value. Determines the present
value of an investment. It computes the
present value based on a series of equal
payments, each of amount pmt, discounted
at periodic interest rate int, over the
number of periods in term.
Memory register usage:
Register 0 pmt (periodic payment).
Register 1 int (periodic interest
rate).
Register 2 n (term).
Rate [ ^r ] Periodic interest rate. Returns the
periodic interest necessary for a present
value of pv to grow to a future value of
fv over the number of compounding periods
in term.
Memory register usage:
Register 0 fv (future value).
Register 1 pv (present value).
Register 2 n (term).
Sln [ ^s ] Straight-line depreciation. Computes the
straight-line depreciation of an asset for
one period. The straight-line method of
depreciation divides the depreciable cost
(cost - salvage) evenly over the useful
life of an asset. The useful life is the
number of periods (typically years) over
which an asset is depreciated.
Memory register usage:
Register 0 cost (cost of the asset).
Register 1 salvage (salvage value of
the asset).
Register 2 life (useful life of the
asset).
Syd [ ^y ] Sum-of-the-years-digits depreciation. The
sum-of-the-years'-digits method of depre-
ciation accelerates the rate of deprecia-
tion, so that more depreciation expense
occurs in earlier periods than in later
ones. The depreciable cost is the actual
cost minus salvage value. The useful life
is the number of periods (typically years)
over which an asset is depreciated.
Memory register usage:
Register 0 cost (cost of the asset).
Register 1 salvage (salvage value of
the asset).
Register 2 life (useful life of the
asset).
Register 3 period (period for which
depreciation is computed).
Term [ T ] Payment period. Returns the number of pay-
ment periods in the term of an ordinary
annuity necessary to accumulate a future
value of fv, earning a periodic interest
rate of int. Each payment is equal to
amount pmt.
Memory register usage:
Register 0 pmt (periodic payment).
Register 1 fv (future value).
Register 2 int (periodic interest
rate).
LOGICAL MODE
< [ < ] Shift the current entry to the left. The
shift can be between 1 and 15 places [ 1-
9, a-f ]. This calculator key has a popup
menu associated with it.
> [ > ] Shift the current entry to the right. The
shift can be between 1 and 15 places [ 1-
9, a-f ]. This calculator key has a popup
menu associated with it.
&16 [ ] ] Truncate the current entry to a 16 bit
unsigned integer.
&32 [ [ ] Truncate the current entry to a 32 bit
unsigned integer.
Or [ | ] Perform a logical OR operation on the
current entry and the next entry, treating
both numbers as unsigned long integers.
And [ & ] Perform a logical AND operation on the
current entry and the next entry, treating
both numbers as unsigned long integers.
Not [ ~ ] Perform a logical NOT operation on the
current entry.
Xor [ ^ ] Perform a logical XOR operation on the
current entry and the next entry, treating
both numbers as unsigned long integers.
Xnor [ n ] Perform a logical XNOR operation on the
current entry and the next entry, treating
both numbers as unsigned long integers.
SCIENTIFIC MODE
Trig [ T ] Set the current trigonometrical base. This
can be in degrees [ d ], grads [ g ] or
radians [ r ]. This key also has a popup
menu associated with it.
Hyp [ h ] Toggle the hyperbolic function indicator.
This switch affects the type of sine,
cosine and tangent trigonometric functions
performed.
Inv [ i ] Toggle the inverse function indicator.
This switch affects the type of sine,
cosine and tangent trigonometric functions
performed.
e^x [ { ] Returns e raised to the power of the
current entry.
10^x [ } ] Returns 10 raised to the power of the
current entry.
y^x [ y ] Take the last entry and raise it to the
power of the next entry.
x! [ ! ] Return the factorial of the current entry.
Note that the factorial function is only
valid for positive integers.
Cos [ ^c ] Return the trigonometric cosine, arc
cosine, hyperbolic cosine or inverse
hyperbolic cosine of the current display,
depending upon the current settings of the
hyperbolic and inverse function switches.
The result is displayed in the current
trigonometric units (degrees, radians or
grads).
Sin [ ^s ] Return the trigonometric sine, arc sine,
hyperbolic sine or inverse hyperbolic sine
of the current display, depending upon the
current settings of the hyperbolic and
inverse function switches. The result is
displayed in the current trigonometric
units (degrees, radians or grads).
Tan [ ^t ] Return the trigonometric tangent, arc
tangent, hyperbolic tangent or inverse
hyperbolic tangent of the current display,
depending upon the current settings of the
hyperbolic and inverse function switches.
The result is displayed in the current
trigonometric units (degrees, radians or
grads).
Ln [ N ] Return the natural logarithm of the
current entry.
Log [ G ] Return the base 10 logarithm of the
current entry.
Rand [ ? ] Return a random number between 0.0 and
1.0.
FILES
~/.desksetdefaults
stored X resources.
.calctoolrc user's personal calctool startup file.
SEE ALSO
Solaris User's Guide
"About Calculator" in the Help Handbook available through
the Help option on the Workspace menu.
NOTES
The OpenWindows environment may no longer be supported in a
future release. You may want to migrate to CDE, the Common
Desktop Environment.
|
Закладки на сайте Проследить за страницей |
Created 1996-2025 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |