2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
6 .. index:: MODULO, modulo, division, modulo
10 MODULO --- Modulo function
11 **************************
13 .. function:: MODULO(A,P)
15 ``MODULO(A,P)`` computes the :samp:`{A}` modulo :samp:`{P}`.
18 Shall be a scalar of type ``INTEGER`` or ``REAL``.
21 Shall be a scalar of the same type and kind as :samp:`{A}`.
22 It shall not be zero. (As a GNU extension, arguments of different kinds are
26 The type and kind of the result are those of the arguments. (As a GNU
27 extension, kind is the largest kind of the actual arguments.)
36 .. code-block:: fortran
41 .. code-block:: fortran
45 print *, modulo(17.5,5.5)
47 print *, modulo(-17,3)
48 print *, modulo(-17.5,5.5)
50 print *, modulo(17,-3)
51 print *, modulo(17.5,-5.5)