Numeric intrinsics
- abs(x) — the absolute value of a number.
- sqrt(x) — the square root.
- mod(a, b) — the remainder of a divided by b.
- max(a, b, ...) / min(a, b, ...) — the largest / smallest of the arguments.
- nint(x) — the nearest whole number to x.
- sin(x), cos(x), tan(x), exp(x), log(x) — the standard elementary functions.
Array intrinsics
- sum(array) — the sum of the elements.
- product(array) — the product of the elements.
- maxval(array) / minval(array) — the largest / smallest element.
- dot_product(a, b) — the dot product of two rank-one arrays.
- matmul(a, b) — matrix multiplication of two rank-two arrays.
- size(array [, dim]) — the number of elements, or the extent along one dimension.
- shape(array) — the extents of each dimension.
- transpose(matrix) — the transpose of a rank-two array.
Inquiry intrinsics
- kind(x) — the kind type parameter of a value.
- len(string) — the length of a character value.
- present(argument) — whether an optional dummy argument was supplied.
Using the reference
The entries above are the intrinsics that appear most often in everyday Fortran. Each takes the standard types and returns the type its name suggests; element-wise functions such as sqrt are elemental, meaning they work on a whole array as easily as on a scalar. A short example:
program quick_example
implicit none
real :: x = -3.5
integer :: r
r = mod(10, 4)
print *, 'abs of x: ', abs(x)
print *, '10 mod 4: ', r
end program quick_exampleFor the surrounding language features these intrinsics operate on, see Arrays and Intrinsic Functions.