Click or drag to resize

FloatingPointComparison.EqualsSignificantDigits Method (Double, Double, Int32, Int32)

Compares two numbers up to the specified number of significant digits.

Namespace:  AGI.Foundation
Assembly:  AGI.Foundation.Core (in AGI.Foundation.Core.dll) Version: 25.1.421.0 (25.1.421.0)
Syntax
public static bool EqualsSignificantDigits(
	double x,
	double y,
	int significantDigits,
	int maxDigitDifference
)

Parameters

x
Type: System.Double
The first number to compare.
y
Type: System.Double
The second number to compare
significantDigits
Type: System.Int32
The number of significant digits to consider in the comparison.
maxDigitDifference
Type: System.Int32
The maximum difference in the last significant digit.

Return Value

Type: Boolean
true if the nth significant digit of the two numbers differ by no more than 1 and all preceding significant digits are equal; otherwise false.
See Also