Visible to Intel only — GUID: GUID-E603A9C2-FE1A-467B-9023-C22A90CC97E7
Visible to Intel only — GUID: GUID-E603A9C2-FE1A-467B-9023-C22A90CC97E7
MIN
Elemental Intrinsic Function (Generic): Returns the minimum value of the arguments.
result = MIN (a1,a2[,a3...])
a1, a2, a3 |
(Input) All must have the same type (integer, real, or character) and kind parameters. |
Results
For arguments of character type, the result type is character, and the length of the result is the length of the longest argument. For MIN0, AMIN1, DMIN1, QMIN1, IMIN0, JMIN0, and KMIN0, the result type is the same as the arguments. For MIN1, IMIN1, JMIN1, and KMIN1, the result type is integer. For AMIN0, AIMIN0, AJMIN0, and AKMIN0, the result type is real. The value of the result is that of the smallest argument. For character arguments, the comparison is done using the ASCII collating sequence. If the selected argument is shorter than the longest argument, the result is extended to the length of the longest argument by inserting blank characters on the right.
Specific Name 1 |
Argument Type |
Result Type |
---|---|---|
INTEGER(1) |
INTEGER(1) |
|
IMIN0 |
INTEGER(2) |
INTEGER(2) |
AIMIN0 |
INTEGER(2) |
REAL(4) |
MIN0 2 |
INTEGER(4) |
INTEGER(4) |
AMIN0 3, 4 |
INTEGER(4) |
REAL(4) |
KMIN0 |
INTEGER(8) |
INTEGER(8) |
AKMIN0 |
INTEGER(8) |
REAL(4) |
IMIN1 |
REAL(4) |
INTEGER(2) |
MIN1 4, 5, 6 |
REAL(4) |
INTEGER(4) |
KMIN1 |
REAL(4) |
INTEGER(8) |
AMIN1 7 |
REAL(4) |
REAL(4) |
DMIN1 |
REAL(8) |
REAL(8) |
QMIN1 |
REAL(16) |
REAL(16) |
1These specific functions cannot be passed as actual arguments. 2Or JMIN0. 3Or AJMIN0.AMIN0 is the same as REAL (MIN). 4In Standard Fortran, AMIN0 and MIN1 are specific functions with no generic name. For compatibility with older versions of Fortran, these functions can also be specified as generic functions. 5Or JMIN1.MIN1 is the same as INT (MIN). 6The setting of compiler options specifying integer size can affect MIN1. 7The setting of compiler options specifying real size can affect AMIN1. |
Example
MIN (2.0, -8.0, 6.0) has the value -8.0.
MIN (14, 32, -50) has the value -50.
The following shows another example:
INTEGER m1, m2
REAL r1, r2
m1 = MIN (5, 6, 7) ! returns 5
m2 = MIN1 (-5.7, 1.23, -3.8) ! returns -5
r1 = AMIN0 (-5, -6, -7) ! returns -7.0
r2 = AMIN1(-5.7, 1.23, -3.8) ! returns -5.7