%format latex
%macropackage=lplain

\documentstyle[12pt,refman]{article}

\newcommand{\myop}[1]{{\bf #1}}

\title{Clac --- The Manual}
\author{Eero Tamminen \\
	Version~0.96 \\
	24.~May 1994}

\pagestyle{myfootings}
\markboth{Clac --- The Manual}{Clac (C) 1994 by Eero Tamminen}

\begin{document}

\maketitle \makeauthor
\newpage

\section{Name}

	clac() --- an expression evaluation function.

\section{Description}

	{\sl Clac\/} calculates expressions following the precedence (order
	of operations). Functions and variables are case-insensitive for
	the user's convenience.

	The parser catches common mistakes like unmatched parenthesis or
	divide by zero and returns an appropriate error code in the
	communication structure. Unrecognized characters produce
	also an error code.


\section{Syntax: Characters and Operators}

	$\diamond$ Recognized characters and operators:
	\begin{description}
	\item[`\myop{+, --}']	Signs. Signed numbers should be in parenthesis.
	\item[`\myop{$|$, \&}']	Bitwise OR and AND operators.
	\item[`\myop{+, --}']	Addition and subtraction operators.
	\item[`\myop{$*$, /}']	Multiply and divide operators.
	\item[`\myop{\char`^}']	Exponentiation operator.
	\item[`\myop{.}']	Decimal point.
	\item[`\myop{(, )}']	Parenthesis.
	\item[`\myop{\#}$x$']	Value $x$ is in octal format.
	\item[`\myop{\%}$x$']	Value $x$ is in binary format.
	\item[`\myop{\$}$x$']	Value $x$ is in hexadecimal format.
	\item[`\myop{;}']	Used to separate comment from an expression.
	\end{description}


\section{Syntax: Functions}

	$\diamond$ Single parameter functions:
	\begin{description}
	\item[\myop{ln}$(x)$]	Natural logarithm of $x$.
	\item[\myop{lg}$(x)$]	Logarithm of $x$ in base 10.
	\item[\myop{deg}$(x)$]	Convert $x$ radians to degrees.
	\item[\myop{rad}$(x)$]	Convert $x$ degrees to radians.
	\item[\myop{sin}$(x)$]	Sine of $x$.
	\item[\myop{cos}$(x)$]	Cosine of $x$.
	\item[\myop{tan}$(x)$]	Tangent of $x$.
	\item[\myop{asin}$(x)$]	Arcus sine of $x$.
	\item[\myop{acos}$(x)$]	Arcus cosine of $x$.
	\item[\myop{atan}$(x)$]	Arcus tangent of $x$.
	\item[\myop{sinh}$(x)$]	Hyperbolic sine of $x$.
	\item[\myop{cosh}$(x)$]	Hyperbolic cosine of $x$.
	\item[\myop{tanh}$(x)$]	Hyperbolic tangent of $x$.
	\item[\myop{sqrt}$(x)$]	Square root of $x$.
	\end{description}

	$\diamond$ Multi parameter functions:
	\begin{description}
	\item[\myop{avg}$(a, b, c)$]	Average of numbers $a, b, c$.
	\item[\myop{std}$(a, b, c)$]	Standard deviation
				$\left( \sqrt{\sum(x_i - \overline x)^2 / n}\, \right)$
				of numbers $a, b, c$.
	\end{description}


\section{Limitations}


	\begin{itemize}
	\item Values are internally calculated using double precision numbers.
	\item No overflow check.
	\end{itemize}


\section{Bugs}

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


\section{Examples}

	{\tt \begin{verbatim}
	$FF.8 - ((%10101.01 * 12) + 5) / 3.7 + (-1)
	\end{verbatim}}

	$ sin(90) + 1 $


\section{Development}

	Clac was programmed with {\sl K\&R C} using {\sl MicroEmacs} editor
	(Can you imagine something more masochistic?).

	Source code available at request, if I still have it\dots


\section{Thanks to}

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

\section{Copyright}

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

	Freeware.


\section{Check also}

	{\sl Sketches of Spain} ({\bf Miles Davis}).

\end{document}
