MODULO — Modulo function#

MODULO(A, P)#

MODULO(A,P) computes the A modulo P.

Parameters
  • A – Shall be a scalar of type INTEGER or REAL.

  • P – Shall be a scalar of the same type and kind as A. It shall not be zero. (As a GNU extension, arguments of different kinds are permitted.)

Returns

The type and kind of the result are those of the arguments. (As a GNU extension, kind is the largest kind of the actual arguments.)

Standard:

Fortran 95 and later

Class:

Elemental function

Syntax:
RESULT = MODULO(A, P)
Example:
program test_modulo
  print *, modulo(17,3)
  print *, modulo(17.5,5.5)

  print *, modulo(-17,3)
  print *, modulo(-17.5,5.5)

  print *, modulo(17,-3)
  print *, modulo(17.5,-5.5)
end program
See also:

MOD