Divides each element of the first inputVector by the corresponding element of the second, putting the remainder from each division into the resultVariable. If one input vector is shorter than the other, it will be "virtually extended" to the same length of the other by repeating its last element. The REMAINDER command computes the remainder using Java's remainder operator, '%'. This operator follows the rule (x/y)*y +x%y == x This definition has the property that if x%y is z then changing the sign of either x or y will only change the sign of z, not its absolute value. Missing values (NaN or .) in one of the input vectors will result in NaN in the result variable at the same position. |
The following program shows the results of the REMAINDER command for both integers and floating point values: COPY 1,10 vec REMAINDER vec 3 integerRemainders REMAINDER vec 3.5 floatingPointRemainders PRINT integerRemainders floatingPointRemainders The output of this program is the following: integerRemainders: (1.0 2.0 0.0 1.0 2.0 0.0 1.0 2.0 0.0 1.0) floatingPointRemainders: (1.0 2.0 3.0 0.5 1.5 2.5 0.0 1.0 2.0 3.0) |