EsbDecimals - a Free Subset of ESBPCS for .NET

CompareOps.CompareValue Method (Single, Single)

Returns 0 if Values are within a "small" value computed from the supplied precision, 1 if the first value is greater than Y and -1 if the first value is lesser. FloatPrecisionDef defines the precision.

If you just want to know whether two values are the same then use SameValue

[Visual Basic]
Overloads Public Shared Function CompareValue( _
   ByVal x As Single, _
   ByVal y As Single _
) As Integer
[C#]
public static int CompareValue(
   float x,
   float y
);

Parameters

x
First Value to Compare.
y
Second Value to Compare.

Return Value

0 (Same), 1 (First Value Greater) or -1 (Second Value Greater).

Remarks

There is an overloaded version that allows you to specifiy the precision of the comparison.

See Also

CompareOps Class | Esb.Math Namespace | CompareOps.CompareValue Overload List