CompareFloat Routines
Returns -1 if X1 < X2, 0 if they are the same, 1 if X1 > X2.

Unit
QESBPCSMath

Overloaded Variants
Function CompareFloat(const X1, X2: Extended): Integer;
Function CompareFloat(const X1, X2: Double): Integer;
Function CompareFloat(const X1, X2: Single): Integer;

Declaration
Function CompareFloat(const X1, X2: Extended): Integer;

Description
For Values with lots of significant figures, ESBPrecision may need to be changed to a smaller value - ESBDoublePrecision for Doubles and ESBSinglePrecision for Singles.

Parameters
X1 First Float to process.
X2 Second Float to process.

Category
Comparison between Integers and Floats

Implementation

function CompareFloat (const X1, X2: Extended): Integer;
begin
     if SameFloat (X1, X2) then
          Result := 0
     else if X1 < X2 then
          Result := -1
     else
          Result := 1;
End;

Declaration
Function CompareFloat(const X1, X2: Double): Integer;

Implementation

function CompareFloat (const X1, X2: Double): Integer;
begin
     if SameFloat (X1, X2) then
          Result := 0
     else if X1 < X2 then
          Result := -1
     else
          Result := 1;
End;

Declaration
Function CompareFloat(const X1, X2: Single): Integer;

Implementation

function CompareFloat (const X1, X2: Single): Integer;
begin
     if SameFloat (X1, X2) then
          Result := 0
     else if X1 < X2 then
          Result := -1
     else
          Result := 1;
End;


HTML generated by Time2HELP
http://www.time2help.com