diff --git a/X2UtMisc.pas b/X2UtMisc.pas index 9b0604f..d80cf9d 100644 --- a/X2UtMisc.pas +++ b/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;