next up previous contents
Next: Conditional execution - IF Up: Variables and expressions Previous: Variables   Contents


Expressions

Arithmetic expressions may be used anywhere that a value is expected. Expressions may be of mixed type -- operands are automatically converted to the most general type when a mixed type expression is evaluated. The hierarchy of types is I4 $\rightarrow$ R4 $\rightarrow$ R8. Conversions between character (Cnnn), logical and numeric types are not supported. Expressions may contain subexpressions (contained within ordinary brackets), and are evaluated left to right, with normal FORTRAN operator precedence. Array subscripts may also be expressions.

Operators and precedence
- (unary minus) 4
^ (exponentiation) 3
* (multiplication) 2
/ (division) 2
+ (addition) 1
- (subtraction) 1

A higher precedence indicates that the operator is applied before any operator of lower precedence that could also act on the same argument(s). A small set of standard real functions is also provided. For now only the 13 functions listed below are available, but I can put in more if there is user demand.

Built-in functions
$\sqrt{}$ sqrt
$\vert x\vert$ abs
NINT$(x)$ nint
FLOAT$(x)$ flt
$\log_e$ ln
$\log_{10}$ log
$e^x$ exp
$\sin$ sin
$\cos$ cos
$\tan$ tan
$\arcsin$ asin
$\arccos$ acos
$\arctan$ atan


next up previous contents
Next: Conditional execution - IF Up: Variables and expressions Previous: Variables   Contents
Jamie Leech 2004-08-16