MODULO
— Modulo functionMODULO(A,P)
computes the A modulo P. RESULT = MODULO(A, P)
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. |
INTEGER
:MODULO(A,P)
has the value R such that A=Q*P+R
, where Q is an integer and R is between 0 (inclusive) and P (exclusive). REAL
:MODULO(A,P)
has the value of A - FLOOR (A / P) * P
. 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
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-5.4.0/gfortran/MODULO.html