DIVIDE inputVector inputVector {inputVector} resultVariable

Divides each element of the first input vector by each element of the second input vector. If there are more than two input vectors, the command divides each element of the result of the previous division by the corresponding element of the next input vector. The final result replaces the contents of the result variable.

If the input vectors are of different lengths, the shorter vectors will be "extended" to the length of the longest by repeating their last element as many times as necessary. This extension is only done internally and does not change the actual size or content of the shorter vectors.

If any element is a "missing" value (represented by a "." Or "NaN") the result for that position will also be NaN.

Dividing by zero is an error and will cause the program to abort with an error message.

DATA 1,10 A
DIVIDE A 2 B
PRINT A B

The above program produces the following output:

A: (1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0)
B: (0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0)

This next program ...

DATA 1,10 A
DATA 1,5 B
DIVIDE A B 2 C
PRINT A B C

...produces the following output:

A: (1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0)
B: (1.0 2.0 3.0 4.0 5.0)
C: (0.5 0.5 0.5 0.5 0.5 0.6 0.7 0.8 0.9 1.0)

Note that the size of B is unchanged.