public override bool Equals(object x) { if (x == null) { return(false); } if (x is Int32) { return(Numerator.ToString().Equals(x.ToString()) && Denominator.Equals(1)); } if (x is UInt32) { return(Numerator.ToString().Equals(x.ToString()) && Denominator.Equals(1)); } if (x is Int64) { return(Numerator.ToString().Equals(x.ToString()) && Denominator.Equals(1)); } if (x is UInt64) { return(Numerator.ToString().Equals(x.ToString()) && Denominator.Equals(1)); } if (x is BigInteger) { return(Numerator.ToString().Equals(x.ToString()) && Denominator.Equals(1)); } if (x is MiniRational) { return(Numerator.Equals(((MiniRational)x).Numerator) && Denominator.Equals(((MiniRational)x).Denominator)); } throw new ApplicationException(); }
public override bool Equals(object?obj) { return(obj is Number number && Numerator.Equals(number.Numerator) && Denominator.Equals(number.Denominator) && State == number.State); }
/// <summary>Indicates whether the current object is equal to another object of the same type.</summary> /// <param name="other">An object to compare with this object.</param> /// <returns> /// <see langword="true" /> if the current object is equal to the <paramref name="other" /> parameter; otherwise, /// <see langword="false" />. /// </returns> public bool Equals(Weighting other) { return((other != null) && Numerator.Equals(other.Numerator) && Denominator.Equals(other.Denominator)); }
public bool Equals(CommonRatio other) { return(Numerator.Equals(other.Numerator) && Denominator.Equals(other.Denominator) && RatioSeparator.Equals(other.RatioSeparator)); }