MAX(A1, A2, A3, …)

Purpose

Maximum value.

Class

Elemental function

Argument type and attributes

All the arguments must have the same type, either integer, real or character, and they all must have the same kind type parameter.

Result type and attributes

If the arguments are of the type character, the result is of type character, and the length of the result is the length of the longest argument. Otherwise the result type is the same as that of the arguments. (Some specific functions return results of a particular type.)

Result value

The value of the result is that of the largest argument. For character arguments, the comparison is done using the ASCII collating sequence. If the length of the selected argument is shorter than that of the longest argument, the result is extended to the length of the longest argument by inserting blank characters on the right.

Examples

MAX (-9.0, 7.0, 2.0) has the value 7.0.

MAX ("Z", "BB") has the value "Z".

Specific Name Argument Type Result Type Pass As Arg?
AMAX0 any integer  1  default real no
AMAX1 default real default real no
DMAX1 double precision real double precision real no
QMAX1 REAL(16) REAL(16) no
MAX0 any integer  1  same as argument no
MAX1 any real  2  default integer no
Note:
  •  1  IBM extension: the ability to specify a nondefault integer argument.
  •  2  IBM extension: the ability to specify a nondefault real argument.