When comparing floating point numbers, make sure you round to an acceptable level of rounding for the type of application you are using.
Languages Focus: Comparison Operators
A comparison operator compares two values either literals as in "Hello" and 3 or variables as in X and Counter. Most languages use the same operators for comparing both numbers and strings. Perl, for example, uses separate sets of comparison operators for numbers and strings.
Delphi Comparison Operators
Common comparison operators:
=
equal
<>
not equal
<
less than
>
greater than
<=
less than or equal
>=
greater than or equal
Syntax Example:
//Does Delphi evaluate the math correctly? Yes!
//Refer to math.pas MaxSingle for more info.
if (0.1 + 0.1 + 0.1 = 0.3) then ShowMessage('correct') else ShowMessage('not correct')
Delphi 2009 Working Example
Here's a simple working example from a button click event: