NAME

	Front - a simple command line arithmetic calculator


SYNOPSIS

	front [-options] [@filename | expression]


DESCRIPTION

	Front calculates expressions following precedence (order of
	operations). Functions, variables and mode identifiers are
	case-insensitive for the user's convenience.

	Front has three modes of operation:
		- An expression is parsed from arguments.
		- Without a filename or expression Front enters
		  interactive mode. Expressions are evaluated as
		  they are entered.
		- Expressions are read from a file.

	If file named 'front.ini' exists in the current directory, it's
	executed before anything else is done.

	The parser catches common mistakes like unmatched parenthesis or
	divide by zero and gives an (hopefully helpful) error message.
	Unrecognized characters produce also an error message.

	You can exit from interactive mode by giving Front an empty line.


OPTIONS

	command line options recognized by Front.

		-d	Output result in decimals (default).
		-b	Output result in binary.
		-o	Output result in octal decimals.
		-h	Output result in hex decimals.
		-r	Trigonometric arguments as radians (default).
		-g	Trigonometric arguments as degrees.


SYNTAX: CHARACTERS AND OPERATORS

	Front recognizes the following characters and operators:

		<Enter>	Evaluate expression or exit if none entered.
		+,-	Signs. Signed numbers should be in parenthesis.
		|,&	Bitwise OR and AND operators.
		+,-	Addition and subtraction operators.
		*,/	Multiply and divide operators.
		^	Exponentiation operator.
		.	Decimal point.
		( and )	Parenthesis.
		=	Assignment operator. Eg. 'test = 3.5'.
		:	Mode (look at options) change character. Eg. ':b'.
		#x	Value x is in octal format.
		%x	Value x is in binary format.
		$x	Value x is in hexadecimal format.
		E	Variable containing value of Napier's constant.
		PI	Variable containing value of pi.
		? 	Gives a brief overview of the operators and
			functions that Clac currently supports and
			list all the variables.

	You can change the values of all variables including e and pi
	(if you're one of those people that insist pi being 3).

	Variable names may contain only letters and numbers. Variable
	names have to start with a letter.


SYNTAX: FUNCTIONS

	Currently supported single parameter functions:

		ln(x)	Natural logarithm of x.
		lg(x)	Logarithm of x in base 10.
		deg(x)	Convert x radians to degrees.
		rad(x)	Convert x degrees to radians.
		sin(x)	Sine of x.
		cos(x)	Cosine of x.
		tan(x)	Tangent of x.
		asin(x)	Arcus sine of x.
		acos(x)	Arcus cosine of x.
		atan(x)	Arcus tangent of x.
		sinh(x)	Hyperbolic sine of x.
		cosh(x)	Hyperbolic cosine of x.
		tanh(x)	Hyperbolic tangent of x.
		sqrt(x)	Square root of x.

	Currently supported multi parameter functions:

		avg(a, b, c)	Average of numbers a, b, c.
		std(a, b, c)	Standard deviation of numbers a, b, c.

		Number of parameters is unlimited.


EXAMPLES

	From a command line:
		front '42 + $FF.8 - ((%10101.01 * 12) + 5) / 3.7 + (-1)'

	Interactively:
		front -d -b

		Expression: foo = sin(90)
		%1

		Expression: foo + 12
		%1101


STRUCTURE

	Front is composed of two nearly separate 'modules':

	- 'clac.c', which evaluates expressions.

	- 'front.c', which gets expressions from the user, command line
	  arguments or from a file plus takes care of the variable
	  assignments and the help function.

	Communication between these to parts is done with a exp_packet
	structure which is better documented on the 'clac.h' file.


LIMITATIONS

	255 character limit for expressions (do you need more?).

	Values are internally calculated using double precision numbers.

	No overflow check.


ADVANTAGES

	Uses little memory because evaluating is done in the sync with
	the parsering.

	IMO easy to use and add new functions.

	'Calc.c' expression-evaluation part can be easily enchanted
	or incorporated into other programs.


BUGS

	Sure. Haven't yet found any, though. Oh, wait a minute, here's
	one ;)...


DEVELOPMENT

	Front was programmed with K&R C using MicroEmacs editor
	(Can you imagine something more mashochistic?).

	Source code available at request, if I still have it...


THANKS TO

	Jarkko Kniivil"a, who advised me on C syntax.
	J"urgen Lock, who patiently answered to my mail.
	Helpful people on #atari (irc), whom I have
	chatted with: Dirch, Gryf, Infy, Aviva...


COPYRIGHT

	Eero Tamminen / puujalka (irc), t150315@cc.tut.fi.

	Freeware. This code may be used freely in other freeware
	programs on condition that my effort has been mentioned
	on the program documentation. I would also like to get
	a copy of program which incorporates my code...


CHECK ALSO

	Sketches of Spain (Miles Davis).

