Description |
The Max function returns the value of higher of two numeric arguments, A and B.
These arguments may be any of the given numeric types, in any mixture. The result will be normalised to the appropriate value - floating point if either argument is floating point.
|
|
Related commands |
Mean |
|
Gives the average for a set of numbers |
Min |
|
Gives the minimum of two integer values |
CompareValue |
|
Compare numeric values with a tolerance |
|
|
|
Example code : Illustrate integer use of Max |
var
int1, int2, int3 : Integer;
begin
int1 := 37;
int2 := 38;
int3 := Max(int1, int2);
WriteLn('int1 = '+IntToStr(int1));
WriteLn('int2 = '+IntToStr(int2));
WriteLn('Max(int1, int2) = '+IntToStr(int3));
end;
|
Show full unit code |
int1 = 37
int2 = 38
Max(int1, int2) = 38
|
|
Example code : Illustrating Max of mixed number types |
var
int1 : Integer;
float1 : single;
begin
int1 := 37;
float1 := 37.5;
float1 := Max(float1, int1);
WriteLn('Max(float1, int1) = '+FloatToStr(float1));
end;
|
Show full unit code |
Max(float1, int1) = 37.5
|
|