Math387.Max / Maxf Method

Overload List

#SignatureDescription
1function Max(const X: TCplx; const Y: TCplx): TCplx;Maximum of two numbers.
2function Max(const X: TSCplx; const Y: TSCplx): TSCplx;
3function Max(X: Double; Y: Double): Double;Maximum of two real numbers X and Y.
4function Max(X: Double; Y: Integer): Double;
5function Max(X: Integer; Y: Double): Double;Mixed integer/double Max/Min.
6function Max(X: Integer; Y: Integer): Integer;Maximum of two integer numbers X and Y.
7function Max(X: Integer; Y: Int64): Int64;
8function Max(X: Int64; Y: Integer): Int64;Mixed 64/32-bit integer Max/Min.
9function Max(X: Int64; Y: Int64): Int64;Maximum of two 64bit integer numbers X and Y.
10function Max(const X: Single; const Y: Single): Single;
11function Maxf(X: Single; Y: Single): Single;

Overload 1: function Max(const X: TCplx; const Y: TCplx): TCplx;

Maximum of two numbers.

#NameTypeDescription
1XTCplx
2YTCplx

Returns: TCplx (complex) - the maximum of two complex numbers X and Y.

Remarks:

Complex numbers are first compared by the absolute value. If they are equal they are further compared by the unwrapped phase -PI,PI angle.

Overload 2: function Max(const X: TSCplx; const Y: TSCplx): TSCplx;

#NameTypeDescription
1XTSCplx
2YTSCplx

Returns: TSCplx

Overload 3: function Max(X: Double; Y: Double): Double;

Maximum of two real numbers X and Y.

#NameTypeDescription
1XDoublescalar
2YDoublescalar

Returns: Double - the maximum of two real numbers X and Y.

See Also: Math387.Min

Overload 4: function Max(X: Double; Y: Integer): Double;

#NameTypeDescription
1XDoublescalar
2YInteger

Returns: Double

Overload 5: function Max(X: Integer; Y: Double): Double;

Mixed integer/double Max/Min.

#NameTypeDescription
1XInteger
2YDoublescalar

Returns: Double

Remarks:

Delphi promotes the Integer arg to double, but the emitted C++ sees Max(int, double) as AMBIGUOUS between the Integer and double overloads (neither is an exact match). These exact mixed overloads resolve it; in Delphi and C# an exact match wins over the promotion, so no existing call changes.

Overload 6: function Max(X: Integer; Y: Integer): Integer;

Maximum of two integer numbers X and Y.

#NameTypeDescription
1XInteger
2YInteger

Returns: Int32 - the maximum of two integer numbers X and Y.

Examples
Uses MtxVecInt;

procedure Example;
var a: TVecInt;
max, ind: integer;
begin
    CreateIt(a);
    try
        a.SetIt([1,2,3,4]);
        max := a.Max(ind); // max=4, ind = 3
    finally
        FreeIt(a);
    end
end;
See Also: Math387.Min

Overload 7: function Max(X: Integer; Y: Int64): Int64;

#NameTypeDescription
1XInteger
2YInt64

Returns: Int64

Overload 8: function Max(X: Int64; Y: Integer): Int64;

Mixed 64/32-bit integer Max/Min.

#NameTypeDescription
1XInt64
2YInteger

Returns: Int64

Remarks:

Delphi auto-promotes the 32-bit arg to Int64, but the emitted C++ would see Max(long long, int) as AMBIGUOUS between the int and Int64 overloads. These exact overloads resolve it; in Delphi and C# an exact match wins over the promotion, so no existing call changes.

Overload 9: function Max(X: Int64; Y: Int64): Int64;

Maximum of two 64bit integer numbers X and Y.

#NameTypeDescription
1XInt64
2YInt64

Returns: Int64 - the maximum of two 64bit integer numbers X and Y.

See Also: Math387.Min

Overload 10: function Max(const X: Single; const Y: Single): Single;

#NameTypeDescription
1XSingle
2YSingle

Returns: Single

Overload 11: function Maxf(X: Single; Y: Single): Single;

#NameTypeDescription
1XSinglescalar
2YSinglescalar

Returns: Single