MODS function

Syntax

MODS (array1, array2)
CALL -MODS (return.array, array1, array2)
CALL !MODS (return.array, array1, array2)

Description

Use the MODS function to create a dynamic array of the remainder after the integer division of corresponding elements of two dynamic arrays.

The MODS function calculates each element according to the following formula:

XY.element = X - (INT (X / Y) * Y)

X is an element of array1 and Y is the corresponding element of array2. The resulting element is returned in the corresponding element of a new dynamic array. If an element of one dynamic array has no corresponding element in the other dynamic array, 0 is returned. If an element of array2 is 0, 0 is returned. If either of a corresponding pair of elements is the null value, null is returned for that element.

If you use the subroutine syntax, the resulting dynamic array is returned as return.array.

Example

A=3:@VM:7
B=2:@SM:7:@VM:4
PRINT MODS(A,B)

This is the program output:

1S0V3