Min

Function Type:

The min function will work on arguments of the type REAL and INTEGER.

Function Purpose:

The min function will return the minimum value out of all the arguments passed to it. In theory any number of arguments can be passed to it.

Required Arguments:

min(A1, A2, A3, ..... )

A1 can either be a number or variable of type REAL or INTEGER.

A2, A3 and any other arguments that are passed to the min function all must be of the same type as A1.

Optional Arguments:

There are no optional arguments to the min function.

Results:

The operation of the min function is pretty easy to understand. For instance, if the following four variables are passed to the min function:
		x1 = 4.5
		x2 = -78.1
		x3 = 1234.5
		x4 = -1.1
		results = min(x1,x2,x3,x4)
The value stored in results will be -78.1 because that was the smallest number that was passed to the function.

Remember that can can be passed to the min function as well. It is perfectly legitimate to do the following:
		results = min(4,-9,0,22,-897)
The outcome of this operation shouldn't be hard to predict. In addition you should know that mixtures of variables and constants are permitted as long as they all have the same type (all REAL or all INTEGER)
		results = min(x1,x2,x3,x4, 1.0)

Special Note:

The min function is actually a generic name for a group of functions. When the compiler sees a call to the min function, it checks to see which one out of the group of functions that min represents applies. For example, if three integer arguments are passed to min and an integer result is expected, then the compiler will actually use the function AMIN0 to evaluate the arguments. The equivalent function for real arguments is called AMIN1. For more information on this please see lecture seven.

For additional information and examples see:

Lecture seven

Examples: array1.f and charvar.f

Up one level / Home


Written by Jason Wehr : jcw142@psu.edu and Maintained by John Mahaffy : jhm@cac.psu.edu