Eval.hlp


Eval does arithmetic from the command line.  For example,

     eval 2*3

prints the answer 6.

Eval accepts the following infix binary operators:

    +		add
    -		subtract
    *		multiply
    /		divide
    \		mod  (remainder of integer division)
    ^		power
    max		maximum
    min		minimum

Parentheses may be used for grouping.

Eval also accepts the following unary prefix operators:

    +		unary plus
    -		unary minus
    abs		absolute value
    round	rounding to integer
    trunc	truncating to integer
    sqrt	square root
    sqr		square
    sin		\
    cos		 \
    tan		  trig functions in radians
    arcsin	  for example, eval sin 3.14159265 prints 0.00000000358979
    arccos	  and eval sin(3.14159265 / 2) prints 1
    arctan	     \
    sinh	      \
    cosh	       \
    tanh	        \
    ln		natural log
    log		base 10 log
    log2	base 2 log
    exp		raise to a power
    fact	factorial


The expression evaluation code is derived from the public domain spreadsheet
included with Turbo Pascal.

Note that some versions of Microsoft pascal incorrectly decide that your pc
has an 8087 or 80287 math coprocessor when in fact it doesn't.  To check this,
try a simple multiplication.  If eval 2*3 says 2, rather than 6, set the
environment variable

   set NO87=X

in your autoexec.bat file.  (I use a blank in place of the X.)