Skip to main content

MULS

Multiplies the values of corresponding elements in two dynamic arrays.

Synopsis

MULS(dynarray1,dynarray2)

Arguments

dynarray An expression that resolves to a dynamic array of numeric values. If a dynamic array element contains a non-numeric value, MULS treats this value as 0 (zero).

Description

The MULS function multiplies the value of each element in dynarray1 by the corresponding element in dynarray2. It then returns a dynamic array containing the products of these multiplications. If a dynarray element value is missing, or has a null string or non-numeric value, MULS parses its value as 0 (zero).

If the two dynamic arrays have different numbers of elements, the returned dynamic array has the number of elements of the longer dynamic array. By default, the shorter dynamic array is padded with 0 value elements for the purpose of the arithmetic operation. You can also use the REUSE function to define behavior when specifying two dynamic arrays with different numbers of elements.

You can use the NUMS function to determine if the elements in a dynamic array are numeric. You can use the ADDS (addition), SUBS (subtraction), DIVS or DIVSZ (division), MODS (modulo division), and PWRS (exponentiation) functions to perform other arithmetic operations on the corresponding elements of two dynamic arrays.

Examples

The following example uses the MULS function to multiply the elements of two dynamic arrays:

a=3:@VM:22:@VM:33:@VM:4
b=10:@VM:0.5:@VM:0:@VM:-4
PRINT MULS(a,b);  ! returns 30ý11ý0ý-16

The following example multiplies the elements of two dynamic arrays of different length:

a=3:@VM:22:@VM:33:@VM:4
b=10:@VM:0.5
PRINT MULS(a,b);  ! returns 30ý11ý0ý0

See Also

FeedbackOpens in a new tab