MODULO intrinsic function
Standard: F77 F90 F95 F2003 F2008 Example program
<Syntax>
MODULO ( 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 P; for Real type it is mathematically equal to A − FLOOR(A÷P)×P, and for Integer type it is the unique integer R such that A = Q×P + R, where Q is an integer, |R|<P, and R has the same sign as 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.