Added: CompareFloat
This commit is contained in:
parent
bc8f3cd7d6
commit
9f2bf5aa94
28
X2UtMisc.pas
28
X2UtMisc.pas
@ -30,6 +30,16 @@ interface
|
||||
//:: -1 when Value1 is less than Value2.
|
||||
function CompareInt(const AValue1, AValue2: Int64): Integer; overload;
|
||||
|
||||
//:$ Compares two floating point values
|
||||
//:: Returns 0 if the values are equal, 1 if Value1 is greater than Value2 and
|
||||
//:: -1 when Value1 is less than Value2.
|
||||
function CompareFloat(const AValue1, AValue2: Single): Integer; overload;
|
||||
|
||||
//:$ Compares two floating point values
|
||||
//:: Returns 0 if the values are equal, 1 if Value1 is greater than Value2 and
|
||||
//:: -1 when Value1 is less than Value2.
|
||||
function CompareFloat(const AValue1, AValue2: Double): Integer; overload;
|
||||
|
||||
//:$ Checks if the value is within the specified range
|
||||
//:: Returns the Default parameter is the range is exceeded, otherwise
|
||||
//:: the value is returned.
|
||||
@ -80,6 +90,24 @@ begin
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
function CompareFloat(const AValue1, AValue2: Single): Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
if AValue1 > AValue2 then
|
||||
Result := 1
|
||||
else if AValue1 < AValue2 then
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
function CompareFloat(const AValue1, AValue2: Double): Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
if AValue1 > AValue2 then
|
||||
Result := 1
|
||||
else if AValue1 < AValue2 then
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
function InRange;
|
||||
begin
|
||||
Result := ADefault;
|
||||
|
Loading…
Reference in New Issue
Block a user