示例#1
0
            public bool Equals(Fraction obj)
            {
                Fraction a = this.Reduce();
                Fraction b = obj.Reduce();

                return(a.chisl == b.chisl &&
                       a.znam == b.znam &&
                       a.sign == b.sign);
            }
示例#2
0
            public int CompareTo(object obj)
            {
                if (this.Equals(obj))
                {
                    return(0);
                }
                Fraction a = this.Reduce();
                Fraction b = (Fraction)obj;

                b = b.Reduce();
                if (a.chisl * a.sign * b.znam > b.chisl * b.sign * a.znam)
                {
                    return(1);
                }
                return(-1);
            }