Represents a comparer for double-precision
floating-point numbers with specified tolerance.
Extreme.Numerics.Net40 (in Extreme.Numerics.Net40.dll) Version: 6.0.16073.0 (6.0.16073.0)
public class DoubleComparer : IComparer,
Public Class DoubleComparer
Implements IComparer, IComparer(Of Double)
public ref class DoubleComparer : IComparer,
type DoubleComparer =
The DoubleComparer type exposes the following members.
Initializes a new instance of the
Gets or sets the relative tolerance within which
two numbers compare equal.
Compares two Double
values and returns
a value indicating whether one is less than, equal to or greater than the other.
|Equals| (Inherited from Object.)
Determines whether the specified Object
is equal to the current Object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Serves as a hash function for a particular type. (Inherited from Object.)
|GetType| (Inherited from Object.)
Gets the Type
of the current instance.
|MemberwiseClone| (Inherited from Object.)
Creates a shallow copy of the current Object
Returns a string that represents the current object. (Inherited from Object.)
Two apparently equivalent floating-point
numbers may not compare equal because of differences
in their least significant digits. This is usually
caused by round-off error resulting from the finite
precision of floating-point representations.
For example, the C# expression, (double)1/3 == (double)0.33333,
does not compare equal because the division operation
on the left-hand side has maximum precision while the
constant on the right-hand side is only precise to the
Instead, determine if the two sides of a
comparison are close enough to equal for your purposes.
The DoubleComparer class lets you
specify the tolerance within which two numbers are
Supported in: 6.0, 5.x, 4.x