9.3.94 MAX (A1, A2 [, A3,...])

Description:  Returns the maximum value of the arguments.  
Class:  Elemental function; Generic 
Arguments:  A1, A2, and A3 (opt) must all have the same type (integer or real) and kind parameters. 
Results:  For MAX0, AMAX1, DMAX1, QMAX1, IMAX0, JMAX0, and KMAX0, the result type is the same as the arguments. For MAX1, IMAX1, JMAX1, and KMAX1, the result type is integer. For AMAX0, AIMAX0, AJMAX0, and AKMAX0, the result is of type real. The value of the result is that of the largest argument.

Specific Name1  Argument Type  Result Type 
  INTEGER(1)  INTEGER(1) 
  INTEGER(1)  REAL(4) 
IMAX0  INTEGER(2)  INTEGER(2) 
AIMAX0  INTEGER(2)  REAL(4) 
MAX0 2  INTEGER(4)  INTEGER(4) 
AMAX0 3,4  INTEGER(4)  REAL(4) 
KMAX0  INTEGER(8)  INTEGER(8) 
AKMAX0  INTEGER(8)  REAL(4) 
IMAX1  REAL(4)  INTEGER(2) 
MAX1 4,5,6  REAL(4)  INTEGER(4) 
KMAX1  REAL(4)  INTEGER(8) 
AMAX1 7  REAL(4)  REAL(4) 
DMAX1  REAL(8)  REAL(8) 
QMAX1  REAL(16)  REAL(16) 
1 These specific functions cannot be passed as actual arguments.
2 Or JMAX0.
3 Or AJMAX0. AMAX0 is the same as REAL (MAX).
4 In Fortran 90, AMAX0 and MAX1 are specific functions with no generic name. For compatibility with older versions of Fortran, these functions can also be specified as generic functions.
5 Or JMAX1. MAX1 is the same as INT (MAX).
6 The setting of compiler options specifying integer size can affect MAX1.
7 The setting of compiler options specifying real size can affect AMAX1.

Examples

MAX (2.0, -8.0, 6.0) has the value 6.0.

MAX (14, 32, -50) has the value 32.


Previous Page Next Page Table of Contents