home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 52
/
Amiga_Dream_52.iso
/
Beos
/
util
/
unixcalc-1.4b.txt
< prev
next >
Wrap
Text File
|
1998-01-10
|
10KB
|
224 lines
File: unixcalc-1.4b.zip
Author: Michael Griebling (mgriebling@inspired.to)
Release: 1.4 (10 Jan 1998)
Compatibility: PR/PR2
Location: contrib/utility
Description: A CLI-based equation-evaluating calculator with up to 52-digits.
Notes: See below.
WHAT IS IT?
UnixCalc is a command line calculator which can evaluate algebraic
equations and uses non-volatile history lists to store unlimited
equations, calculated results, and arbitrarily-named variables. There
are several numerical display modes which include floating point,
scientific, and engineering notation. The scientific mode supports
imaginary numbers for most functions. Standard functions
(+,-,*,/,Sqrt,^) are accurate to more than 50 digits. Based numbers
(2 to 16) are also supported along with all the standard logical
operators (see table below).
Some additional features are:
o imaginary numbers and functions
o unlimited named variables (up to 16 characters long)
o automatic history logging of both equations and results
o full scientific, transcendental, power, and logarithmic operations
o programmer functions like and, or, shift, rotate, etc., on 172-bits!
o choice of radian, degree, or gradian angle measurements
o from 8 to 52 digits
o numbers from -1E9999 to 1E9999
o exact decimal number representation
o convenience functions like square and cube roots, reciprocal, etc.
o persistant variables, equations, and state
RELATED TOOLS
If you prefer a GUI-based calculator with the same features as
UnixCalc, ExCalc is available for the Amiga on the Aminet & Fish
Disks. BeCalc for the BeBox will also soon be available. Both
calculators are shareware products.
CHANGES
UnixCalc now requires OO2C and its new libraries so it will no
longer compiler with O2C. DO NOT upgrade if you don't want to
rebuild using OO2C, although why you wouldn't want to use OO2C,
which builds faster executables, I don't want to know.
The source code was also cleaned up a bit to work directly
with the new OO2C library and remove stub modules.
A new Help command is available which lists all the available
functions and a brief description of each one.
A bug has been fixed in the string to hexadecimal conversion
routine.
TO BUILD & INVOKE
OO2C and GCC are required to build the executable image for
UNIXCALC. OO2C can be obtained from http://www.uni-kl.de/ooc.
GCC is generally available from most internet sites. Once the above
two packages are installed, just type "oo2c -Mv UnixCalc" to build the
calculator.
The executable can be placed in any suitable directory. UnixCalc
creates several configuration files in the user's home directory to
store variables and a history list of equations and previous results.
NOTE: This release changes the format of the .CalculatorState.bin
file so you may have to delete this file to get the variable lists
working properly.
To start a session, type "UnixCalc" and enter an expression to be
evaluated at the prompt. For example, "UnixCalcD> " is the prompt
which normally appears when the calculator is using base 10 numbers
and using degree measurements for angles. An empty line will
terminate UnixCalc.
EQUATION SYNTAX
Equations are entered using infix notation like "23.4 + 56".
Brackets can be used to explicitly order the expression evaluation
order although standard mathematical ordering is supported (e.g.,
23+6*5 gives 53 NOT 145). Most functions like Sin, Cos, etc. use a
single argument which follows the function. Brackets are not strictly
required (i.e., Sin 45 will evaluate correctly) but are recommended to
avoid ambiguities with equations like Sin 45+23 which first evaluates
Sin 45 and then adds 23 to this number. An exception to the single
argument rule for functions are the Min/Max functions which take two
arguments separated by a semicolon.
All functions can be nested to an arbitrary depth (limited by the
stack size on the host computer). Maximum expression length is 250
characters although expressions can be strung together by storing
intermediate results in variables and using the variable in subsequent
calculations. For example: Sqrt(56^2 + 23^2) ST Root1 saves the
answer in a named variable called Root1. All variables and function
names are case sensitive, so Root1 is different from ROOT1. Typing
the name of a variable by itself returns the contents of that
variable. Attempting to access a variable which has not been defined
returns an error. A maximum of 20 variables are allowed in this
version of UnixCalc of which the first 16 are predefined for you as
M0 to M15. If you attempt to define more than this number
of variables, you will get an error message. Delete one or more
variables with the "DEL <variable>" command. All defined variables
can be displayed with the "List" command.
Numbers can use separator characters like ",", "'", and "_" (e.g.,
"3,143.43" and "0FFF_1234_0000"). For European countries it is also
possible to swap the '.' and ',' characters -- although this is not
explicitly supported in this version of the calculator. Contact me
at the address below if you would like to know how to make this
change to the calculator. Displayed numbers are always without
separator characters although, once again, number displays with
separators are supported by modifying some internal settings.
The table below lists the supported keywords by the equation parser
(any octal codes if shown as readable characters on your system can
also be used to invoke the corresponding function):
+ Addition
- Subtraction
*,╫ Multiplication
/,≈ Division
▓ Squared
│ Cubed
-╣,»╣ Reciprocal
() Brackets
^, ** Power
% ╫ 0.01
&, And Logical And
|, Or Logical Inclusive Or
Xor Logical Exclusive Or
~,Not Logical Complement
Mod Modulo
Div Integer Division
Sqrt Square Root
Cbrt Cube Root
Root Any Root
Abs Absolute value
Rand Random number between 0 and 1
e Natural Log Base
e^ Power of e
i,í Imaginary number
° Complex angle
Im Imaginary part of a number
Re Real part of a number
╗í Polar to rectangle conversion
r Complex magnitude
Conj Complex conjugate
Conv <n> Convert n units to destination units
nCr Factorial combinations
nPr Factorial permutations
Frac Fractional part of a number
Int Integer part of a number
Sign Sign of a number (-1 or 1)
Plot <expression> Plot the expression as f(M0) (not supported -- yet)
Min(<x>;<y>) Minimum of x and y
Max(<x>;<y>) Maximum of x and y
Ln Natural Logarithm
Log Base 10 Logarithm
Sin, ASin, Sin»╣ Sine, Arcsine
Cos, ACos, Cos»╣ Cosine, Arccosine
Tan, ATan, Tan»╣ Tangent, Arctangent
Sinh, ASinh, Sinh»╣ Hyperbolic Sine, Arcsine
Cosh, ACosh, Cosh»╣ Hyperbolic Cosine, Arccosine
Tanh, ATanh, Tanh»╣ Hyperbolic Tangent, Arctangent
SBit Set Bit
CBit Clear Bit
TBit Toggle Bit
Shr Shift Right
Shl Shift Left
Asr Arithmetic Shift Right
Ror Rotate Right
Rol Rotate Left
<var-name> Variable contents
ST <var-name> Store to variable
DEL <var-name> Deletes the variable
List Lists all defined variables
Help, help Displays this list
Pi Constant Pi
SCI Toggle Scientific/Floating Point
BAS n Change to Base n
DIG n Use n Digits
DP n Use n Decimal Places
DRG Toggle Degree/Radian/Grad
LEGAL STUFF
UnixCalc -- a command line calculator
Copyright (C) 1996-1998 Michael Griebling
UnixCalc is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
UnixCalc is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with UnixCalc; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
CONTACT
Michael Griebling
c/o Computer Inspirations
150 Clark Blvd., Suite One
Brampton, Ontario
Canada, L6T 4Y8
Tel/FAX: (905) 840-7964
e-mail: mgriebling@inpired.to
http://www.inspired.to/be