modulo(3I)
MODULO - Modulo function
As shipped in IRIX 6.5.7. Last changed in IRIX 6.5.5.
NAME MODULO - Modulo function SYNOPSIS MODULO ([A=]a, [P=]p) IMPLEMENTATION UNICOS, UNICOS/mk, IRIX systems CF90, MIPSpro 7 Fortran 90 STANDARDS Fortran DESCRIPTION The MODULO function returns the remainder of a divided by p using modulo math. The result always has the sign of the modulo base, p. This function accepts the following arguments: a Must be of type integer or real p Must be of the same type and kind type parameter as a MODULO is an elemental function. The name of this intrinsic cannot be passed as an argument. RETURN VALUES The result type and type parameter are the same as a. When a is of type integer, if p is not equal to zero, MODULO (a, p) has the value r such that a = q x p + r, where q is an integer. The inequality 0 <= r < p holds if p > 0, and p < r <= 0 holds if p < 0. If p = 0, the result is 0. When a is of type real, if p is not equal to zero, the value of the result is a - FLOOR (a / p) * p. The result can be a NaN when that value is available. EXAMPLES Example 1. MODULO(8,5) has the value 3. Example 2. MODULO(-8,5) has the value 2. Example 3. MODULO(8,-5) has the value -2. Example 4. MODULO(-8,-5) has the value -3. SEE ALSO Intrinsic Procedures Reference Manual for the printed version of this man page.