MOD intrinsic function

Standard: F77 F90 F95 F2003 F2008 Example program


<Syntax>

MOD ( A, P )

A : Integer or Real;
P : Same type and kind as A, conformable with A, not equal to zero; the NAG Fortran Compiler also permits P to have a different kind (this is non-standard);

Result : Same type as A, with kind the same as the kind of A+P.

<Semantics>

The result is the remainder for A divided by P, with the same sign as A; it is mathematically equal to A − INT(A÷P)×P.

Like many intrinsic functions, this is elemental; if either (or both) of A and P is an array, the result will be an array with that shape, with the value being computed elementwise.

<Related>

MODULO intrinsic function