MULTIPLY

MULTIPLY returns the product of x and y, with a precision specified by p and q.

If both operands are FIXED and at least one is FIXED BIN, then the base, precision, and scale are determined by the PRECTYPE compiler option. Otherwise, the base, precision, and scale are determined by the rules for expression evaluation. The mode is REAL if both operands are REAL; otherwise, it is COMPLEX.

Read syntax diagramSkip visual syntax diagramMULTIPLY( x, y, p, q)
x and y
Expressions.
p
Restricted expression that specifies the number of digits to be maintained throughout the operation.
q
Restricted expression that specifies the scaling factor of the result. For a fixed-point result, if q is omitted, a scaling factor of zero is assumed. For a floating-point result, q must be omitted.
Note that when applied to FIXED DECIMAL, then if the mathematical result is too big for the specified precision p but less than the maximum implementation value,
  • if SIZE is disabled, the FIXEDOVERFLOW condition will not be raised and the result will be truncated
  • if SIZE is enabled, the SIZE condition will be raised

Note that the above text is false when the non-default compiler option DECIMAL(FOFLONMULT) is in effect. In that case, FIXEDOVERFLOW will be raised if SIZE is disabled (and the result is too big).