Description: | Returns the modulo of the arguments. | ||

Class: | Elemental function; Generic | ||

Arguments: |
A | Must be of type integer or real. | |

P | Must have the same type and kind parameters as A. | ||

Results: |
The result type is the same as A. The
result value depends on the type of A, as follows:
- If A is of type integer and P is not equal to zero, the
value of the result is
`A - FLOOR(REAL(A)/REAL(P)) * P` . - If A is of type real and P is not equal to zero, the value
of the result is
`A - FLOOR(A/P) * P` .
If P is equal to zero (regardless of the type of A), the result is undefined. |

**Examples**

MODULO (7, 3) has the value 1.

MODULO (9, -6) has the value -3.

MODULO (-9, 6) has the value 3.

Previous Page Next Page Table of Contents