2.5.4.74 Mul
The Mul function performs a multiplication calculation.
ABNF:
-
Mul = val val " _MUL():128"
Required Arguments:
Name: Arg1
Type: vDoubleEx
An argument that specifies the first operand of the multiplication operation.
Name: Arg2
Type: vDoubleEx
An argument that specifies the second operand of the multiplication operation.
Return Value:
This function returns a vNum or a PtgCy containing Arg1 multiplied by Arg2. The type of the return value is calculated by the following algorithm.
SET return type = PtgNum
SET returnDimension = 0
SET returnCurrencyID = 0
IF Arg1.Type = PtgCy AND Arg2.Type != PtgCy THEN
SET returnType = PtgCy
SET returnCurrencyID = currencyID of Arg1
ELSE IF Arg1.Type != PtgCy AND Arg2.Type = PtgCy THEN
SET returnType = PtgCy
SET returnCurrencyID = currencyID of Arg2
ELSE IF Arg1.Type = PtgCy AND Arg2.Type = PtgCy THEN
SET returnType = PtgCy
IF currencyID of Arg1 = currencyID of Arg2 OR currencyID of Arg2 = 1 THEN
SET returnCurrencyID = currencyID of Arg1
ELSE IF currencyID of Arg1 = 1 THEN
SET returnCurrencyID = currencyID of Arg2
ELSE
SET returnType = PtgErr
END IF
ELSE IF Arg1.Unit = PtgNumPctAND Arg2.Unit = PtgNumPct
SET returnType = PtgNumPct
SET returnDimension = 1
ELSE IF Arg1.Unit = PtgNumPct
SET returnType = PtgNumPct
SET returnDimension = Arg2.dimension
ELSE IF Arg2.Unit = PtgNumPct
IF Arg1.Unit is a vUnitType
SET returnType = Arg1.Unit
SET returnDimension = Arg1.Dimension
ELSE
SET returnType = Arg2.Unit
SET returnDimension = Arg1.Dimension
END IF
ELSE IF Arg1.Unit is a vUnitType THEN
SET returnType = Arg1.Unit
SET returnDimension = Arg1.Dimension + Arg2.Dimension
ELSE IF Arg2.Unit is a vUnitType THEN
SET returnType = Arg2.Unit
SET returnDimension = Arg1.Dimension + Arg2.Dimension
END IF
IF returnType = PtgCy THEN
Return type is PtgCy with currencyID = returnCurrencyID
ELSE IF returnType = PtgErr THEN
Return type is PtgErr with error code of #VALUE!
ELSE IF (returnType = PtgAcre OR returnType = PtgHectare) AND returnDimension != 2 THEN
Return type is PtgNumMultiDim with unit = PtgNumDftand dimension = returnDimension
ELSE IF returnDimension = 0 THEN
Return type is PtgNum
ELSE IF returnDimension = 1 THEN
Return type is returnType
ELSE
Return type is PtgNumMultiDim with unit = returnType and dimension = returnDimension
END IF