Compares two double precision values using an absolute and a relative criterion.

Namespace:  ceometric.VectorGeometry
Assembly:  ceometric.VectorGeometry (in ceometric.VectorGeometry.dll) Version: 1.8.0.0 (1.8.0.0)

Syntax

C#
public static bool AlmostEquals(
	double a,
	double b,
	double absoluteEpsilon,
	double relativeEpsilon
)
Visual Basic (Declaration)
Public Shared Function AlmostEquals ( _
	a As Double, _
	b As Double, _
	absoluteEpsilon As Double, _
	relativeEpsilon As Double _
) As Boolean
Visual C++
public:
static bool AlmostEquals(
	double a, 
	double b, 
	double absoluteEpsilon, 
	double relativeEpsilon
)

Parameters

a
Type: System..::.Double
A double precision value.
b
Type: System..::.Double
A double precision value.
absoluteEpsilon
Type: System..::.Double
The absolute epsilon criterion.
relativeEpsilon
Type: System..::.Double
The relative epsilon criterion.

Return Value

Returns true if a and b are equal with respect to an absolute and a relative criterion, false otherwise.

Remarks

This comparison concept largely eliminates floating point errors by comparing two double precision values with respect to both an absolute and a relative criterion.

The absolute delta comparison has the form Math.Abs(a - b) > AbsoluteEpsilon

The relative delta comparison has the form

Math.Abs((a - b) / a) > RelativeEpsilon for a > b

or

Math.Abs((a - b) / b) > RelativeEpsilon else.

See Also