Пример #1
0
 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));
 }
Пример #2
0
        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);
            }
        }
Пример #3
0
 private bool Equals(ComplexNumber other)
 {
     return(RealPart.Equals(other.RealPart) && ImagPart.Equals(other.ImagPart));
 }