public static bool IsCloseTo(this Estimate e, Estimate other) { if (e.IsTerminal()) { if (!other.IsTerminal()) { return(false); } return(e.SameSignWith(other)); } else // not terminal { if (other.IsTerminal()) { return(false); } // both are not terminal there -- allow 10% discrepancy from max abs value int maxAbsValue = Math.Abs(Math.Max(e.Value, other.Value)); int absDiff = Math.Abs(e.Value - other.Value); return(absDiff < maxAbsValue * 0.1); } }