EsbDecimals - a Free Subset of ESBPCS for .NET

CompareOps.SameValue Method (Single, Single, Single)

Returns True if the Values are within a "small" value computed from the supplied Precision. For Values with lots of significant figures, then Precision should be made smaller.

If you want more control over the comparison then use CompareValue

[Visual Basic]
Overloads Public Shared Function SameValue( _
   ByVal x As Single, _
   ByVal y As Single, _
   ByVal precision As Single _
) As Boolean
[C#]
public static bool SameValue(
   float x,
   float y,
   float precision
);

Parameters

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

Return Value

true if values are within precision of each other.

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.SameValue Overload List