SUMMARY
Evaluates simple arithmetic expressions.
SYNTAX
EVALUATE {TO TERM|name} {v} op v {op v ...}
where op is one of the following:
+ - * / ** SQRT EXP ALOG ALOG10 SIN COS TAN ASIN ACOS ATAN EQ NE LE GE LT GT ADD SUBTRACT MULTIPLY DIVIDE
INPUT
TO TERM: Result is written to the user's terminal. TO name: Result is written to the blackboard variable name. v: An floating point or integer number. (Since all arithmetic is done in floating point, integers are converted to floating point numbers.) op: One of the arithmetic or logical operators listed above.
EMBEDDED ARITHMETIC FUNCTIONS
An embedded arithmetic function is a simple math operation similar to those in any programming language, e.g. FORTRAN, C, etc, and is of the general form:
( number operator number ... )
where number is a numeric value and operator is one of the following arithmetic operators:
+ - * / **
All numbers are treated as real, and all arithmetic is done in double-precision floating point.
DEFAULT VALUES
EVALUATE TO TERM 1. * 1.
DESCRIPTION
This command lets you evaluate arithmetic and logical expressions. The arithmetic expression can be a compound containing more than one operator. In this case the expression is evaluated left to right. There is no nesting capability. A logical expression can contain only one operand. The result of evaluating this expression can be written to the user's terminal or to a specified blackboard variable. This blackboard variable can later be used directly in other commands. This is especially useful when writing macros. You can also get the value of a blackboard variable using the GETBB command. Previously, there was a maximum number of operators (10) in a single command. As of v101.6, there is no maximum number.
EXAMPLES
Two simple examples:
SAC> EVALUATE 2 * 3 ==> 6 SAC> evaluate tan 45 ==> 1.61978Here is a sightly more complicated example:
SAC> EVALUATE 4 * atan 1 / PI ==> 1Finally let's repeat the previous example but this time use a blackboard variable:
SAC> evaluate to temp1 4 * atan 1 SAC> evaluate %temp1 / PI ==> 1 SAC>
SEE COMMANDS
GETBB SAC_MACROS
LATEST REVISION
2013 (v101.6a)