EsbDecimals - a Free Subset of ESBPCS for .NET

CompareOps.CompareValue Method (Single, 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. For Values with lots of significant figures, then Precision should be made smaller.

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, _
   ByVal precision As Single _
) As Integer
[C#]
public static int CompareValue(
   float x,
   float y,
   float precision
);

Parameters

x
First Value to CompareOps.
y
Second Value to CompareOps.
precision
Precision to used for comparison, should be positive and small, see FloatPrecisionDef.

Return Value

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

Remarks

There is an overloaded version without the Precision that will use FloatPrecisionDef for the Precision value.

See Also

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