max

Date:

11-14-2011

NAME

MAX, MAX0, AMAX1, DMAX1, MAX1, AMAX0, MIN, MIN0, AMIN1, DMIN1, MIN1, AMIN0 - Return maximum or minimum values

SYNOPSIS

MAX ([A1=]a1, [A2=]a2 [,[A3=]a3] ... )
MAX0 ([A1=]a1, [A2=]a2 [,[A3=]a3] ... )
AMAX1 ([A1=]a1, [A2=]a2 [,[A3=]a3] ... )
DMAX1 ([A1=]a1, [A2=]a2 [,[A3=]a3] ... )


MAX1 ([A1=]a1, [A2=]a2 [,[A3=]a3] ... )
AMAX0 ([A1=]a1, [A2=]a2 [,[A3=]a3] ... )
MIN ([A1=]a1, [A2=]a2[,[A3=] a3] ... )
MIN0 ([A1=]a1, [A2=]a2[,[A3=] a3] ... )
AMIN1 ([A1=]a1, [A2=]a2[,[A3=] a3] ... )
DMIN1 ([A1=]a1, [A2=]a2[,[A3=] a3] ... )


MIN1 ([A1=]a1, [A2=]a2[,[A3=] a3] ... )
AMIN0 ([A1=]a1, [A2=]a2[,[A3=] a3] ... )

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran

DESCRIPTION

The MAX, MAX0, AMAX1, DMAX1, MAX1, and AMAX0 intrinsic functions determine the maximum numerical values. The MAX intrinsic also determines the greatest character value at each index position of all arrays. For example:

MAX ((/"A", "Z"/), (/"BB", "Y"/)) yields (/"BB", "Z"/)

MAX is the generic name; the others are specifics.

The MIN, MIN0, AMIN1, DMIN1, MIN1, and AMIN0 intrinsic functions find minimum numerical values. The MIN intrinsic also determines the least character value at each index position of all arrays. For example:

MIN ((/"Z", "A"/), (/"YY", "B"/)) yields (/"YY", "A"/)

MIN is the generic name; the others are specifics.

All intrinsic functions listed in this man page accept the following arguments:

a1,a2,a3,

All arguments must have the same data type and must be of type: REAL, INTEGER, or CHARACTER (MAX only). However, the kind types of the arguments can differ (this is an extension to the Fortran standard). The maximum number of arguments you can specify in the argument list is 63.

These are elemental intrinsic functions. The names of these intrinsics cannot be passed as arguments.

RETURN VALUES

The MAX routines return the largest argument. The MIN routines return the smallest argument.

The MAX or MIN routine returns a result that has the same type and kind type as the arguments. For character type arguments, the length of the result is the length of the longest argument. If the selected argument is shorter than the longest argument, blanks (SPACES) are added to fill up the space on the right.

MAX0 and MIN0 accept and return type integer.

AMAX1 and AMIN1 accept and return type single-precision real.

DMAX1 and DMIN1 accept and return type double-precision real.

MAX1 and MIN1 accept type real and return type default integer.

AMAX0 and AMIN0 accept type integer and return type default real.

EXAMPLES

MAX(-9.0,7.0,2.0) yields 7.0.

MAX (“Z”, “BB”) yields “Z”

MAX ((/”A”, “Z”/), (/”BB”, “Y”/)) yields (/”BB”, “Z”/)

MIN(-9.0,7.0,2.0) yields -9.0.

MIN (“A”, “YY”) yield “A”

MIN ((/”Z”, “A”/), (/”YY”, “B”/)) yields (/”YY”, “A”/)