public static bool AreClose(double left, double right) { if (left == right) { return true; } double a = (Math.Abs(left) + Math.Abs(right) + 10.0) * 2.2204460492503131E-16; double b = left - right; return (-a < b) && (a > b); }