MOD(3f)

DESCRIPTION
MOD(A,P) computes the remainder of the division of A by P.

STANDARD
Fortran 77 and later

CLASS
Elemental function

SYNTAX
RESULT = MOD(A, P)

ARGUMENTS

A Shall be a scalar of type INTEGER or REAL. P Shall be a scalar of the same type and kind as A and not equal to zero.

RETURN VALUE
The return value is the result of A - (INT(A/P) * P). The type and kind of the return value is the same as that of the arguments. The returned value has the same sign as A and a magnitude less than the magnitude of P.

EXAMPLE
          program test_mod
            print *, mod(17,3)
            print *, mod(17.5,5.5)
            print *, mod(17.5d0,5.5)
            print *, mod(17.5,5.5d0)

            print *, mod(-17,3)
            print *, mod(-17.5,5.5)
            print *, mod(-17.5d0,5.5)
            print *, mod(-17.5,5.5d0)

            print *, mod(17,-3)
            print *, mod(17.5,-5.5)
            print *, mod(17.5d0,-5.5)
            print *, mod(17.5,-5.5d0)
          end program test_mod

SPECIFIC NAMES

Name Arguments Return type Standard MOD(A,P) INTEGER A,P INTEGER Fortran 95 and later AMOD(A,P) REAL(4) A,P REAL(4) Fortran 95 and later DMOD(A,P) REAL(8) A,P REAL(8) Fortran 95 and later

SEE ALSO
MODULO

AUTHOR

This information was taken from the GFortran documentation (https://gcc.gnu.org/onlinedocs/gcc-5.3.0/gfortran/) and converted to a manpage by AstroFloyd (http://astrofloyd.org).