Lahey/Fujitsu Fortran

MIN Function

Description

The MIN function returns the minimum value from a list of INTEGER or REAL arguments.

Syntax

MIN (a1, a2 [, a3, ...])

Arguments

The arguments are INTENT(IN) scalars or arrays of type INTEGER or REAL. They must all be of the same type and kind.

If more than one argument is an array, all arrays must have the same shape.

Result

The result is of the same type and kind as the arguments.

If all the arguments are scalar, the result is the value of the smallest argument.

If any of the arguments are arrays, the result is an array with the same shape. Each element of the result is as if the scalar MIN function was called for each corresponding element of the array argument(s).

Example

integer :: i6(6)=(/-14,3,0,-2,19,1/) write(*,*) min(i6,0) ! writes -14 0 0 -2 0 0 write(*,*) min(-14,3,0,-2,19,1) ! writes -14