next up previous contents index
Next: Substitution of numerical expressions Up: Numeric evaluation of expressions Previous: Numeric evaluation of expressions   Contents   Index

The expression evaluator

The command interpreter contains an expression evaluator, written by Mark Morley. With it it is possible to make directly computations or to parse arguments of commands (see 7 for more details). With this expression evaluator it is possible to define variables and to use numerical functions. If the command interpreter receives a command that it not in its list of known commands, this command is sent to the expression evaluator, evaluated as a numerical expression, and the result is printed to screen. The evaluation gives 0 if the expression is incorrect (it is an unknown variable for instance).


Example :

- interpcom -> a=1
                 1.000000
- interpcom -> b=-2
                 -2.000000
- interpcom -> newvar=a+b
                 -1.000000

(here

 - interpcom ->
is the prompt of the interpreter). It is possible also to insert spaces :

- interpcom -> newvar = a + b

This will give the same result, except of course if you have a command called newvar. So in general it is better to put no spaces inside a numerical expression.



2009-11-12