Caché MultiValue Basic Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

Multiplies the values of corresponding elements in two dynamic arrays.
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).
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.
The following example uses the MULS function to multiply the elements of two dynamic arrays:
PRINT MULS(a,b);  ! returns 30ý11ý0ý-16
The following example multiplies the elements of two dynamic arrays of different length:
PRINT MULS(a,b);  ! returns 30ý11ý0ý0
See Also