Previous Topic Next topic Print topic


MULTIPLY Function

Purpose

Multiplies an arithmetic value by an arithmetic value and returns the product with a specified precision and an optionally specified scale factor.

Syntax

MULTIPLY(x,y,p)

or

MULTIPLY(x,y,p,q)

Parameters

x and y are arithmetic values, and p and q are integer constants that represent precision and scale factor, respectively.

Description

The MULTIPLY function multiplies an arithmetic value, x, by an arithmetic value, y, and returns the product with a specified precision p and an optionally specified scale factor q.

The result is x*y, having the common data type of x and y.

The precision of the result is (p,q) or (p). In the latter case, q equals zero.

Examples

DECLARE (LENGTH, WIDTH) FIXED BINARY(15);
   .
   .
   .
PUT LIST ('TOTAL AREA IS'||MULTIPLY (LENGTH, WIDTH, 31));

Restrictions

The parameter q must not occur unless the result type is decimal.

Previous Topic Next topic Print topic