MAXVAL intrinsic function
Standard: F77 F90 F95 F2003
  Example Program

ARRAY : rank N array of type Integer, Real or Character;
DIM : scalar Integer in the range 1 to N;
MASK : array of type Logical and the same shape as ARRAY;

Result: Same type and type parameters as ARRAY.
Returns the maximum value of the masked elements of ARRAY. If DIM is absent, the result is scalar. If DIM is present, it reduces the array in that dimension with the MAX operation; the result has the shape of ARRAY with dimension DIM omitted.

If no elements are selected for a set of MAX operations, the result is the lowest value possible for ARRAY.

The ability to apply MAXVAL to type Character was added by Fortran 2003.
Array-array operations, Array-scalar operations, MAXLOC intrinsic function, MINLOC intrinsic function, MINVAL intrinsic function, Reduction intrinsic functions