|
NAMEspar - a modular console calculatorSYNOPSISspar [options] [--] expression DESCRIPTIONSpar is a console calculator, primarily intended for problem solving in arbitrary precision. It supports also modules (aka code that can be loaded dynamically) and a number of other features, such as: user variables, functions, and constants.OPTIONS
NUMBERSThe most basic element in spar is the number. Numbers are double precision numbers. All numbers are represented internally as a standard C double variable. There are no attributes of numbers, but the precision can affect the number output. This precision is both in the integer part and the decimal part.For example: The number 0.123456789 is represented internally as a double precision variable, but if we change the precision, the output will change: 0.123456789 = 0.123457 VARIABLESNumbers can be stored in named variables. Variable names begin with a letter followed by any number of letters, digits and underscores. The variable names are case sensitive. Variables may have values assigned to them as well as used in expressions and it contains a special data member that stores the "previous" value".To declare a variable you must supply both a name and a value. Any undeclared variable generate an error. For example, to declare the variable i of value 5 enter: i = 5 CONSTANTSConstants are special variables that is read-only. This means that you can read a constant value but you can modify. There is a number of "preloaded" variables such as "e", "pi" ecc.FUNCTIONSspar support a number of often used scientific functions (directly from The Spar Library). For example, to get the value of the natural logarithm in 0 enter:log(0) Trig FunctionsThese are the familiar `sin', `cos', and `tan' functions. The arguments to all of these functions are in units of radians; recall that pi radians equals 180 degrees.Inverse Trig FunctionsThese are the usual arc sine, arc cosine and arc tangent functions, which are the inverses of the sine, cosine and tangent functions respectively.Exponents and LogarithmsThese are the 'exp' group, 'log' group, 'pow' group and 'sqrt' group.Hyperbolic Functionssinh, cosh, tanh. The functions in this section are related to the exponential functions.Inverse Hyperbolic Functionsasinh, acosh, atanh. The functions in this section are related to the Hyperbolicfunctions.Infinite Functionsisnan, finite, isinf.Special FunctionsFactorial, sum, and other specific spar functions.EXPRESSIONSThe numbers are manipulated by expressions and statements. Since the math parser was implemented to be interactive, statements and expressions are executed as soon as possible.A simple expression is just a constant. spar displays constants using the current precision (see OPTIONS). Full expressions are similar to many other high level languages. Since there is only one kind of number, there are no rules for mixing types. In the following descriptions of legal expressions, "expr" refers to a complete expression and "var" refers to a simple variable.
COMMANDS
FEATURESSpar supports terminal features (termios) to allow the program to be more user-friendly and also more robust.READLINE OPTIONSpar can be compiled (via configure script) to use the GNU readline input editor library. This allows the user to do more editing of lines before sending them to spar.It also allows for a history of previous lines typed: the history can be viewed by '´ key, whereas the readline auto-completion was implemented by the TAB key. For more information, read the user manuals for the GNU readline and history libraries. Instead the key '!' run the last command and, finally the key ':' can be used to display a specific history item. For example: ':1' shows the first history item. SIGNALS SUPPORTDuring a session, the SIGINT signal (usually generated by the control-C character from the terminal), SIGSTP signal (usually generated by the control-Z character from the terminal) and SIGTERM signal will cause execution to be interrupted. After all run-time structures have been cleaned up, a message will be printed to notify the user that spar is aborted. All variables and modules are removed during the clean up process.TERMCAP SUPPORTThe control key EOF is inhibited. spar restore this setting on exit.BUGSThe best way to submit a bug report for Spar is to use the file BUG-REPORT, that will enable me to fix the problem. Please visit the Spar homepages at:http://spar.sourceforge.net/index.html (main site) http://web.tiscalinet.it/Davide18/index.html for the latest version, patches and documentation. FILES/usr/local/bin/spar Spar /usr/local/lib/libspar.so Spar Library /usr/local/include/spar/* Spar Headers /usr/local/lib/spar/* Spar modules /usr/local/share/spar/modules_config Spar modules config AUTHORDavide Angelocola davide178@inwind.itACKNOWLEDGMENTSThe author would like to thank Sebastian Ritterbusch (Rascal@Ritterbusch.de) for his extensive help in testing the program and the documentation. Many great suggestions were given. Please visit his website http://rascal.sourceforge.net or the sourceforge project at http://sourceforge.net/projects/rascal.SEE ALSObc(1) An arbitrary precision calculator languageSpar can be used also as library, a API reference can be founded via web at http://sourceforge.net/projects/spar. Please help me to extend and correct it.
Visit the GSP FreeBSD Man Page Interface. |