Esempio n. 1
0
 /// <summary>
 /// Compares two numbers.
 /// https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
 /// </summary>
 /// <param name="x">The first number.</param>
 /// <param name="y">The second number.</param>
 /// <returns><c>true</c> if the two values are equal, otherwise false.</returns>
 /// <remarks>
 /// This will check if the two numbers are adjacent or equal to each other. This is equivalent to
 /// calling Equals(x, y, 1).
 /// </remarks>
 public static bool Equals(double x, double y)
 {
     return(Precision.Equals(x, y, 1));
 }
Esempio n. 2
0
 /// <summary>
 /// Compares two numbers.
 /// https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
 /// </summary>
 /// <param name="x">The first number.</param>
 /// <param name="y">The second number.</param>
 /// <returns><c>true</c> if the two values are equal, otherwise false.</returns>
 /// <remarks>
 /// This will check if the two numbers are adjacent or equal to each other. This is equivalent to
 /// calling Equals(x, y, 1).
 /// </remarks>
 public static bool Equals(float x, float y)
 {
     return(Precision.Equals(x, y, 1));
 }