Clicky

Fortran Wiki
mod (Rev #2, changes)

Skip the Navigation Links | Home Page | All Pages | Recently Revised | Authors | Feeds | Export |

Showing changes from revision #1 to #2: (追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)

Description

mod(a,p) computes the remainder of the division of a by p. It is calculated as a - (int(a/p) * p).

Standard

(削除) Fortran 77 and later (削除ここまで)(追記) FORTRAN 77 (追記ここまで)(追記) and later (追記ここまで)

Class

(削除) Elemental function (削除ここまで)(追記) Elemental function (追記ここまで)

Syntax

result = mod(a, p)

Arguments

  • a - Shall be a scalar of type integer or real
  • 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_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

category: (削除) Intrinsics (削除ここまで)(追記) intrinsics (追記ここまで)

Revision from April 30, 2009 20:17:38 by Jason Blevins
Forward in time (to current) | Back in time (1 more) | See current | Hide changes | History | Rollback | View: Source | Linked from: Intrinsic procedures, modulo

AltStyle によって変換されたページ (->オリジナル) /