next up previous 229
Next: Arithmetic operations.
Up: Expression Syntax
Previous: Expression Syntax

Constants.

Numerical constants may be written using any of the standard Fortran 77 forms (integer, real or double precision). For positive constants, a preceding $+$ sign is optional. Thus, all the following are valid constants:

0 $-$1 57 $+$666 1.0 $+$3. 0.5438
.303 $-$.5 1.234d6 $-$4.6e$-$3 9E4 $+$.44D$+$19 3e0

The special constant `$<$BAD$>$' may also be used and represents a bad (i.e. undefined) value; any expression containing it evaluates to the standard Starlink bad value for the data type being transformed.

At present there is no distinction between the data types of constants, so the form in which they are written does not matter and their interpretation depends only on the type of arithmetic in use when the expression is evaluated. This, in turn, may depend on the type of data being transformed (Section [*]) so constant values are converted automatically to the data type required. For instance, a constant written as `2.1' might be interpreted as integer (2), real (2.1E0), or double precision (2.1D0) according to the type of arithmetic being used.

N.B. Handling of data types may change in future to allow implicit type conversion and ``mixed mode'' arithmetic. To avoid possible problems, floating-point to integer conversion of constants should currently be avoided if the constant has a fractional part. In practice such cases are rare.



next up previous 229
Next: Arithmetic operations.
Up: Expression Syntax
Previous: Expression Syntax

TRANSFORM Coordinate Transformation Facility
Starlink User Note 61
R.F. Warren-Smith
12th January 2006
E-mail:starlink@jiscmail.ac.uk

Copyright © 2000 Council for the Central Laboratory of the Research Councils