p - Shall be a scalar of the same type as a and not equal to zero

Return value

The kind of the return value is the result of cross-promoting the kinds of the arguments.

Example

program test_modprint*,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)endprogram test_mod