calc - a command line calculator.

SYNOPSYS

calc 'expression'

DESCRIPTION

calc is a command line calculator. It evaluates its arguments as a single awk language expression and prints the result on the standard output.

The results of the last few expressions evaluated by calc are kept in a file by default named ~/.calc. The file is used as a stack. The top value may be accessed in a calc expression as "". Other values on the stack may be accessed with an index on "". for example "[2] is the second value on the stack. The name of the stack file may be set with the -s <filename> option.

In csh it is convienient to alias calc to "=" to mimic the behavoir of the IRAF cl compute mode. In addition file name substitution can be turned off within the alias so that "*" need not be escaped within an expression.

  alias = 'set noglob; calc \!*; unset noglob'

OPTIONS

-s <filename>
set the calc stack file name (default ~/.calc).
-D
Print out the awk program to be executed before forking.

EXAMPLES

	john@panic : calc 4 + 6
	10

	john@panic : calc 4:00:00 + 0:30:00
	 4:30:00

	john@panic : calc @ + 2:00:00
	 6:30:00

DETAILS

calc is implimented by wrapping the user expression in a simple awk language program and calling an awk interpreter. The text of the program is:
	BEGIN {	print < expression > }

ENVIRONMENT

TABLEAWK
the name of the awk interpreter to execute. The default interpreter is tawk.
TABLEFUNCTIONS
a path specifying directories to find the source for undefined functions.

SEE ALSO

<#mawk>
an implimentation of the awk programming language by Mike Brennan.
<#tawk>
awk language extensions implimented at SAO.
<#slalink>
a tawk extension for inclusion of the slalib astrometry libraries.