public bool Equals(Constant other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(RealPart.Equals(other.RealPart) && ImaginaryPart.Equals(other.ImaginaryPart)); }
public override bool Equals(object obj) { var complexnum = obj as ComplexNumber; if (complexnum != null) { return(complexnum.RealPart == RealPart && complexnum.ImaginaryPart == ImaginaryPart); } if (!Isreal()) { return(false); } try { return(RealPart.Equals(Convert.ToDouble(obj))); } catch (Exception) { return(false); } }
private bool Equals(ComplexNumber other) { return(RealPart.Equals(other.RealPart) && ImagPart.Equals(other.ImagPart)); }