# MODSZ

Modulo division of corresponding elements in two dynamic arrays (zero divide allowed).

## Synopsis

```MODSZ(dynarray1,dynarray2)
```

### Arguments

 dynarray An expression that resolves to a dynamic array of numeric values.

## Description

The MODSZ function divides the value of each element in dynarray1 by the corresponding element in dynarray2. It then returns a dynamic array containing the modulo (remainder) for each element that results from these divisions. If an element is missing or has a null string or a non-numeric value, MODSZ parses its value as 0 (zero).

When MODSZ encounters a 0 divisor, it returns 0 for that element. This is the same 0 divisor behavior as the DIVSZ function. The corresponding MODS function does not allow division by zero; attempting to divide by zero generates a <DIVIDE> error, ending execution of the function and invoking an error trap handler, if available.

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 MOD function or the REM function to perform modulo division on single values.

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), MULS (multiplication), DIVS or DIVSZ (division), and PWRS (exponentiation) functions to perform other arithmetic operations on the corresponding elements of two dynamic arrays.

## Examples

The following example uses the MODSZ function to return the modulo value for each division operation on the elements of two dynamic arrays:

```a=11:@VM:22:@VM:0:@VM:-7
b=10:@VM:.5:@VM:10:@VM:42
PRINT MODSZ(a,b);  ! returns 1ý0ý0ý-7```