public int CompareTo(Rational other) { var sign = Sign.CompareTo(other.Sign); if (sign != 0) { return(sign); } if ((IsNaN && other.IsNaN) || (IsInfinity && other.IsInfinity)) { return(0); } if (IsNaN || other.IsNaN) { return(Denominator.CompareTo(other.Denominator)); } if (IsPositiveInfinity || other.IsNegativeInfinity) { return(1); } if (IsNegativeInfinity || other.IsPositiveInfinity) { return(-1); } var diff = this - other; return(diff.Sign); }
public int CompareTo(SingleLabel other) { if (other == null) { return(1); } int result = Sign.CompareTo(other.Sign); if (result != 0) { return(result); } return(SignIndex.CompareTo(other.SignIndex)); }
public override int CompareTo(Expr other) { var pCmp = base.CompareTo(other); if (other is TermNumericalExpr e) { if (pCmp == 0) { pCmp = Sign.CompareTo(e.Sign); if (pCmp == 0) { pCmp = Exprs.SetCompareTo(e.Exprs); } } } return(pCmp); }
public int CompareTo(object obj) { ZNAK znak = obj as ZNAK; return(Sign.CompareTo(znak.Sign)); }