-1 LessThanValue The first value is less than the second
value.
0 EqualsValue The two values are equal.
1 GreaterThanValue
var
A : Single;
B : Single;
C : Single;
begin
A := 23.0;
B := 23.0;
C := 23.1;
//
Compare 2 equal floats
case CompareValue(A,
B) of
LessThanValue :
ShowMessage('A < B');
EqualsValue :
ShowMessage('A = B');
GreaterThanValue
: ShowMessage('A > B');
end;
//
Compare 2 unequal floats
case CompareValue(A,
C) of
LessThanValue :
ShowMessage('A < C');
EqualsValue :
ShowMessage('A = C');
GreaterThanValue
: ShowMessage('A > C');
end;
//
Compare 2 unequal floats - but allow for a difference of up
to +/- 0.2
case CompareValue(A,
C, 0.2) of
LessThanValue :
ShowMessage('A < C');
EqualsValue :
ShowMessage('A = C');
GreaterThanValue
: ShowMessage('A > C');
end;
end;