Download Language Reference Manual

Transcript
to make sure that it is interpreted as you intend. The expression (–2.0)**2
produces the result 4.0.
Table 4–3 lists the result types of arithmetic operations with operands of
various types.
Table 4–3 Result Types of Arithmetic Operators
Operator
Type of Operands
Result Type
+
*
**
INTEGER, INTEGER64,
UNSIGNED, UNSIGNED64
REAL, DOUBLE,
QUADRUPLE
Same as the operands if both are
of the same type; otherwise, the
operand of the lower-ranked type is
converted and the result is of the
higher-ranked type.
/
INTEGER, INTEGER64,
UNSIGNED, UNSIGNED64,
REAL, DOUBLE, QUADRUPLE
One of the real types—REAL if
the operands are of type REAL (or
SINGLE) or a lower-ranked type;
otherwise, the operand of the lowerranked type is converted and the
result is of the higher-ranked type.
DIV
REM
MOD
INTEGER, INTEGER64,
UNSIGNED, UNSIGNED64
Same as the operands if both are
of the same type; otherwise, the
operand of the lower-ranked type is
converted and the result is of the
higher-ranked type.
For More Information:
•
On integers (Section 2.1.1.1)
•
On real numbers (Section 2.2)
•
On more precise and less precise operands, and on type conversions
(Section 4.4)
•
On using the CHECK attribute and SUBRANGE option for MOD run-time
checking (Section 10.2.8)
4.2.2 Relational Operators
A relational operator tests the relationship between two ordinal, real,
DOUBLE, or QUADRUPLE expressions and returns a Boolean result. If
the relationship holds, the result is TRUE; otherwise, the result is FALSE.
Table 4–4 lists the relational operators that you can apply to arithmetic
operands. You can also apply some of the relational operators to string
operands and to set operands.
Expressions and Operators 4–5