EsbDecimals - a Free Subset of ESBPCS for .NET

CompareOps.SameValue Method (Decimal, Decimal, Decimal)

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 Decimal, _
   ByVal y As Decimal, _
   ByVal precision As Decimal _
) As Boolean
[C#]
public static bool SameValue(
   decimal x,
   decimal y,
   decimal precision
);

Parameters

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

Return Value

true if values are within precision of each other.

Remarks

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

See Also

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