Ejemplo n.º 1
0
 /// <summary>
 /// Approximates floating point equality with a maximum number of different bits.
 /// This is typically used in place of an epsilon comparison.
 /// see: https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
 /// see: https://stackoverflow.com/questions/3874627/floating-point-comparison-functions-for-c-sharp.
 /// </summary>
 /// <param name="a">The first value to compare.</param>
 /// <param name="b">>The second value to compare.</param>
 /// <param name="maxDeltaBits">The number of floating point bits to check.</param>
 /// <returns>True if the values are approximately equal, otherwise false.</returns>
 public static bool ApproximatelyEqual(float a, float b, int maxDeltaBits = 1) => MathHelper.ApproximatelyEqual(a, b, maxDeltaBits);