MOD(A, P)
Purpose
Remainder function.
Class
Elemental function
Argument type and attributes
- A
- An
INTENT(IN)INTEGERorREAL - P
-
An
INTENT(IN)argument of the same type and kind type parameter as A.
The kind type parameters can be different if the compiler option
–qport=modis specified.
Result type and attributes
Same as A.
Result value
- If P ≠ 0, the value of the result is A - INT(A/P) * P.
- If P = 0, the result is undefined.
Examples
- MOD (3.0, 2.0) has the value 1.0.
- MOD (8, 5) has the value 3.
- MOD (-8, 5) has the value -3.
- MOD (8, -5) has the value 3.
- MOD (-8, -5) has the value -3.
| Specific Name | Argument Type | Result Type | Pass As Arg? |
|---|---|---|---|
| MOD | default integer | default integer | yes |
| AMOD | default real | default real | yes |
| DMOD | double precision real | double precision real | yes |
| QMOD | REAL(16) | REAL(16) | yes 1 |
|
Note:
|
|||
Related information
For information on alternative behavior for MOD when porting programs to IBM® Open XL Fortran, see the -qport compiler option in the IBM Open XL Fortran Compiler Reference.