Next: Operator precedence
Up: Expression syntax
Previous: Mathematical functions provided
The expression string can contain constants, column and parameter names,
operators, functions, and parentheses. In general the usual rules of
algebra and Fortran should be followed, with some minor exceptions
as noted below.
- Spaces are permitted between items, except that a function-name
must be followed immediately by a left parenthesis. Spaces are not
permitted within items such as names and numerical constants, but can be
used within character strings and date/time values in curly braces.
- Lower-case letters are treated everywhere as identical to the
corresponding upper-case letter.
- Column and parameter names can be up to fifteen characters long, and
may consist of letters, digits, and underscores, except that the first
character must not be a digit.
- Vector elements are supported but with a restricted syntax:
they may consist of a name followed by an unsigned integer constant
subscript enclosed in square brackets, for example FLUX[4] or
MAGNITUDE[13]. The first element of the vector is numbered one.
- CHARACTER constants may be enclosed in a pair of single or
double quotes; embedded quotes of the same type may be denoted by
doubling up on the quote character within the string, for example
'DON''T' or "DON""T".
- LOGICAL constants may be .TRUE. or .FALSE. but
abbreviations of these words are allowed down to .T. and
.F.
- Numerical constants may appear in any valid form for Fortran 77
(except that embedded spaces are not allowed). Some additional forms
are also permitted, as shown below.
- %Xstring %Ostring %Bstring for hexadecimal, octal and binary
INTEGER constants respectively.
- Angles in sexagesimal notation: colons must be used to separate
items, for example hours:minutes:seconds (or degrees:minutes:seconds).
If there is a leading sign then the value will be taken as
degrees:minutes:seconds, otherwise hours:minutes:seconds. In either
case the value is converted to RADIANS.
- A date/time value may be given as a string enclosed in curly
braces; a range of common formats are permitted, with order
year-month-day or day-month-year, and the month as a number or
three-character abbreviation. The time may follow with colons separating
hours:minutes:seconds. Examples of some valid dates:
1992-JUL-26 12:34:56
92.7.26
26/7/92T3:45
- Relational operators are supported in both Fortran 77 form
(for example .GE. .NE.) as well as in the Fortran 90 forms (for
example,
).
- Single-symbol forms for .AND. .OR. and .NOT. are provided as
an alternative: &
# respectively.
- The dots may be left off the Fortran 77 forms of the relational
operators and the logical operators .AND. and .OR. where
spaces or parentheses separate them from names or constants, but the
logical constants and the .NOT. operator need the enclosing dots
to distinguish them from other lexical items in all cases.
- INTEGER division does not result in truncation (as in Fortran)
but produces a floating-point result. The NINT or INT
function should be used (as appropriate) if an INTEGER result is
required.
- The functions MAX and MIN must have exactly two
arguments.
- All arithmetic is carried out internally in DOUBLE PRECISION
(but the compiler works out the effective data type of the result using
the normal expression rules).
- Exponentiation is performed by log/exp functions, with use of
ABS to avoid taking logs of negative arguments, thus -2**3 will
come out as `+8' not `-8'.
Next: Operator precedence
Up: Expression syntax
Previous: Mathematical functions provided
CURSA Catalogue and Table Manipulation Applications
Starlink User Note 190
A.C. Davenhall
4th November 2001
E-mail:starlink@jiscmail.ac.uk
Copyright © 2001 Council for the Central Laboratory of the Research Councils