MAX (The GNU Fortran Compiler)

### 8.197 `MAX` — Maximum value of an argument list ¶

Synopsis:

  `RESULT = MAX(A1, A2 [, A3 [, ...]])`

Description:

  Returns the argument with the largest (most positive) value.

Class:

  Elemental function

Arguments:

  A1 | The type shall be `INTEGER`, `REAL` or `UNSIGNED`.
  A2, A3, ... | An expression of the same type and kind as A1. (As a GNU extension, arguments of different kinds are permitted.)

Return value:

  The return value corresponds to the maximum value among the arguments, and has the same type and kind as the first argument.

Specific names:

  Name | Argument | Return type | Standard
  --- | --- | --- | ---
  `MAX0(A1)` | `INTEGER(4) A1` | `INTEGER(4)` | Fortran 77 and later
  `AMAX0(A1)` | `INTEGER(4) A1` | `REAL(MAX(X))` | Fortran 77 and later
  `MAX1(A1)` | `REAL A1` | `INT(MAX(X))` | Fortran 77 and later
  `AMAX1(A1)` | `REAL(4) A1` | `REAL(4)` | Fortran 77 and later
  `DMAX1(A1)` | `REAL(8) A1` | `REAL(8)` | Fortran 77 and later

Standard:

  Fortran 77 and later. Extension for `UNSIGNED` (see Unsigned integers)

See also:

  `MAXLOC` — Location of the maximum value within an array
  `MAXVAL` — Maximum value of an array,
  `MIN` — Minimum value of an argument list