Modulo function.

**A**- must be of type integer or real.
**P**- must be of the same type and kind type parameter as A.

**Class**

Elemental function

**Result Type and Attributes**

Same as A.

**Result Value**

- Case (i): A is of type integer. If P <> 0, MODULO (A, P)
has the value R such that A = Q * P + R, where Q is an integer.
If P > 0, the inequalities 0 <= R < P hold.

If P < 0, P < R <= 0 hold.

If P = 0, the result is undefined.

- Case (ii): A is of type real. If P <> 0, the value of the
result is A - FLOOR (A / P) * P.
If P = 0, the result is undefined.

**Examples**

- MODULO (8, 5) has the value 3.
- MODULO (-8, 5) has the value 2.
- MODULO (8, -5) has the value -2.
- MODULO (-8, -5) has the value -3.