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
R4
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 |
|
abs |
|
| NINT |
nint |
| FLOAT |
flt |
ln |
|
log |
|
exp |
|
sin |
|
cos |
|
tan |
|
asin |
|
acos |
|
atan |
|