The CONSTANT_TYPE statement
A DCT statement of the form
has the following effects:
where a constant appears without an indication in its immediate context of the appropriate type for that constant, it is to be assigned one of the types above depending on its form:
the normal defaults for FALCON would be established by the statement
Note that, in the first example, a constant containing a decimal point is assumed to be of type DCX even if it has no imaginary part. Thus, the expression _SQR(-1.0) would produce the result _I instead of an error. However, _SQR(-1) will cause an error. Although, as _SQR may have complex arguments, it may not have arguments belonging to any integer type; and therefore it supplies enough context to cause -1 to be converted to a real type, that real type will be determined based on the type LONG_INTEGER originally given to -1, the list of types acceptable to the _SQR function, and the rules for determining implicit type conversion for variables within context: LONG_INTEGER, at priority (2,3,4), becomes replaced by REAL at (3,3,10).
Similarly, if a statement like
is executed, 1/3 will have the REAL value 0.333333..., whereas, as the two constants supply no context for each other, 1/3 would have the INTEGER value 0.
Note that the division operator is not allowed to supply, as contextual information, the fact that it may give fractional results. Log and trig functions, and operators of that kind, accept only REAL arguments, and thus act like _SQR in the above example.
The operator ^ has the special property that it accepts only a REAL argument on its left side (that is, if the argument on its left side is an INTEGER, it will be converted before use), but may accept either a REAL or INTEGER argument on the right side.
The operator # has an even more unusual property; unlike SQR, if both its arguments are constants, the argument on the right side is always treated as if it contained a decimal point: thus, again in the situation of the first example, while _SQR(-1) resulted in an error, -1 being converted to REAL, not the default real constant type of DCX, _SQR(-1#0) would return _I in double precision complex form. This is, of course, because of the important role of # in forming real constants.
A DCT statement can appear anywhere in a program, and its effect continues until contradicted by a subsequent DCT statement or terminated by the end of a compilation. While a DCT statement establishes a default type assumption, as does the IMPLICIT statement, the DCT statement refers to constants, which are used only locally (from the programmer's point of view; the compiler may double up storage for identical constants, of course), while the IMPLICIT statement refers to variables, which are used throughout a program, and therefore may occur only once.