Manual Reference Pages  - min (3fortran)

NAME

MIN(3) - [NUMERIC] Minimum value of an argument list

SYNOPSIS

result = min(a1, a2, a3, ... )

         elemental TYPE(kind=KIND) function min(a1, a2, a3, ... )

TYPE(kind=KIND,intent(in) :: a1 TYPE(kind=KIND,intent(in) :: a2 TYPE(kind=KIND,intent(in) :: a3 : : :

CHARACTERISTICS

o TYPE may be integer, real or character.

DESCRIPTION

MIN(3) returns the argument with the smallest (most negative) value.

The arguments must the same type which shall be integer, real, or character and they also all have the same kind type parameter.

The type and kind type parameter of the result are the same as those of the arguments.

NOTE:

A common extension is that the argument kinds can vary. In that case the returned value may be the kind of the first argument, or might be the kind of the expression a1+a2+a3+a4... per the rules of promotion.

OPTIONS

o A1 : the first element of the set of values to examine.
o A2, A3, ... : An expression of the same type and kind as A1 completing the set of values to evaluate.

RESULT

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

EXAMPLES

Sample program

    program demo_min
    implicit none
    integer :: i
    integer :: rectangle(3,4)=reshape([(-6+i,i=0,11)],[3,4])
        print *, ’basics’
        print *, min(10.0,11.0,30.0,-100.0)
        print *, min(-200.0,-1.0)
        print *, ’elemental’
        print *, min(1,[2,3,4])
        print *, min(5,[2,3,4])

print *, ’box:’ do i=1,size(rectangle,dim=1) write(*,’(*(i3,1x))’)rectangle(i,:) enddo print *, ’make all values 0 or less:’ do i=1,size(rectangle,dim=1) write(*,’(*(i3,1x))’)min(rectangle(i,:),0) enddo end program demo_min

Results:

     >  basics
     >   -100.000000   
     >   -200.000000   
     >  elemental
     >            1           1           1
     >            2           3           4
     >  box:
     >  -6  -3   0   3
     >  -5  -2   1   4
     >  -4  -1   2   5
     >  make all values 0 or less:
     >  -6  -3   0   0
     >  -5  -2   0   0
     >  -4  -1   0   0

STANDARD

FORTRAN 77

SEE ALSO

MAX(3), MAXLOC(3), MINLOC(3), MINVAL(3), MAXVAL(3)

Fortran intrinsic descriptions (license: MIT) @urbanjost ’


Nemo Release 3.1 min (3fortran) November 02, 2024
Generated by manServer 1.08 from 0186108d-b289-4aba-832f-8ea25dd2e871 using man macros.