If any operation in an arithmetic expression is computed in floating-point, the entire expression is computed as if all operands were converted to floating-point and the operations are evaluated using floating-point instructions.
If an expression is computed in floating-point, double-precision floating-point is used if any receiver or operand in the expression is not COMP-1, or if a multiplication or exponentiation operation appears in the expression. Whenever double-precision floating-point is used for one operation in an arithmetic expression, all operations in the expression are computed as if double-precision floating-point instructions were used.
Floating-point exponentiations are always evaluated using double-precision floating-point arithmetic.
The value of a negative number raised to a fractional power is undefined. For example, (-2) ** 3 is equal to -8, but (-2) ** (3.000001) is not defined. When an exponentiation is evaluated in floating-point and there is a possibility that the value of the exponentiation will be undefined (as in the example above), then the value of the exponent is evaluated at run time to determine if it is actually an integer.
The floating-point numeric functions will always return a double-precision floating-point value. For a list of the floating-point and fixed-point functions, see "Types of Numeric Functions" in the IBM Rational Development Studio for i: ILE COBOL Programmer's Guide.
IF operand-1 = expression-1 THEN . . .
where operand-1 is a data-name defined to be COMP-2, and expression-1
contains only fixed-point operands, the rules for floating-point arithmetic
apply to expression-1 because it is being compared to a floating-point operand.EVALUATE expression-1
WHEN expression-2 THRU expression-3
WHEN expression-4
.
.
.
END-EVALUATE
the equivalent IF statements are:
IF expression-1 >= expression-2 AND
expression-1 <= expression-3
IF expression-1 = expression-4
then for each IF statement, the comparands must be looked at
to determine if all the arithmetic in that IF statement will
be fixed-point or floating-point.