Пример #1
0
 /// <summary>
 /// Approximates double-precision floating point equality by an epsilon (maximum error) value.
 /// This method is designed as a "fits-all" solution and attempts to handle as many cases as possible.
 /// </summary>
 /// <param name="a">The first double.</param>
 /// <param name="b">The second double.</param>
 /// <param name="epsilon">The maximum error between the two.</param>
 /// <returns>
 ///  <value>true</value> if the values are approximately equal within the error margin, otherwise
 ///  <value>false</value>.
 /// </returns>
 public static bool ApproximatelyEqualEpsilon(double a, double b, double epsilon = 0.001) => MathHelper.ApproximatelyEqualEpsilon(a, b, epsilon);
Пример #2
0
 /// <summary>
 /// Approximates single-precision floating point equality by an epsilon (maximum error) value.
 /// This method is designed as a "fits-all" solution and attempts to handle as many cases as possible.
 /// </summary>
 /// <param name="a">The first float.</param>
 /// <param name="b">The second float.</param>
 /// <param name="epsilon">The maximum error between the two.</param>
 /// <returns>
 ///  <value>true</value> if the values are approximately equal within the error margin, otherwise
 ///  <value>false</value>.
 /// </returns>
 public static bool ApproximatelyEqualEpsilon(float a, float b, float epsilon = 0.001f) => MathHelper.ApproximatelyEqualEpsilon(a, b, epsilon);