/// <summary>
/// Approximates equivalence between two single-precision floating-point numbers on a direct human scale.
/// It is important to note that this does not approximate equality - instead, it merely checks whether or not
- /// two numbers could be considered equivalent to each other within a certain tolerance.
+ /// two numbers could be considered equivalent to each other within a certain tolerance. The tolerance is
+ /// inclusive.
/// </summary>
/// <param name="a">The first value to compare.</param>
/// <param name="b">The second value to compareĀ·</param>
}
float diff = Math.Abs(a - b);
- return diff < tolerance;
+ return diff <= tolerance;
}
/// <summary>
/// Approximates equivalence between two double-precision floating-point numbers on a direct human scale.
/// It is important to note that this does not approximate equality - instead, it merely checks whether or not
- /// two numbers could be considered equivalent to each other within a certain tolerance.
+ /// two numbers could be considered equivalent to each other within a certain tolerance. The tolerance is
+ /// inclusive.
/// </summary>
/// <param name="a">The first value to compare.</param>
/// <param name="b">The second value to compareĀ·</param>
}
double diff = Math.Abs(a - b);
- return diff < tolerance;
+ return diff <= tolerance;
}
#endregion