Next: MODULO, Previous: MINVAL, Up: Intrinsic Procedures
MOD — Remainder functionMOD(A,P) computes the remainder of the division of A by P. It is
calculated as A - (INT(A/P) * P).
     RESULT = MOD(A, P)
     | A | Shall be a scalar of type INTEGERorREAL | 
| P | Shall be a scalar of the same type as A and not
equal to zero | 
          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
     
     | Name | Arguments | Return type | Standard | 
| AMOD(A,P) | REAL(4) | REAL(4) | F95 and later | 
| DMOD(A,P) | REAL(8) | REAL(8) | F95 and later |