Divides the corresponding elements in two dynamic arrays (zero divide not allowed).
function divides the value of each element in dynarray1
by the corresponding element in dynarray2
. It then returns a dynamic array containing the results of these divisions. If an element value is an empty string or a non-numeric value, DIVS
parses its value as 0 (zero).
can return fractional numbers as the result (quotient) of a division operation. The DIV
function can only return the integer portion of the result (quotient) of a division operation; the fractional portion is truncated.
functions are identical, with one difference:
encounters a 0 divisor, attempting to divide by zero generates a <DIVIDE> error, ending execution of the function and invoking an error trap handler, if available.
encounters a 0 divisor, it returns 0 for that element.
If the two dynamic arrays have different numbers of elements, by default the shorter dynamic array is padded so that the returned dynamic array has the number of elements of the longer dynamic array. If the shorter dynamic array is the dividend (dynarray1
), it is padded with the required number of elements with the value of 0. If the shorter dynamic array is the divisor (dynarray2
), it is padded with the required number of elements with the value of 1. 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
(modulo division), and PWRS
(exponentiation) functions to perform other arithmetic operations on the corresponding elements of two dynamic arrays.
The following example uses the DIVS
function to divide the elements of two dynamic arrays:
! returns 1.1ý44ý0ý-.1666666666667
© 1997-2019 InterSystems Corporation, Cambridge, MA