/// <summary> /// Compares this object to another <see cref="SmartFloat"/> /// for equality. /// </summary> public override bool Equals(object obj) { if (obj is SmartFloat) { SmartFloat tmp = (SmartFloat)obj; if (this.IsEmpty && tmp.IsEmpty) { return(true); } else { return(this.Float.Equals(tmp.Float)); } } else if (obj is float) { return(this.Float.Equals((float)obj)); } else if (obj is string) { return(this.CompareTo(obj.ToString()) == 0); } else { return(false); } }
/// <summary> /// Compares one SmartFloat to another. /// </summary> /// <remarks> /// This method works the same as the <see cref="int.CompareTo"/> method /// on the Float inttype, with the exception that it /// understands the concept of empty int values. /// </remarks> /// <param name="value">The int to which we are being compared.</param> /// <returns>A value indicating if the comparison int is less than, equal to or greater than this int.</returns> public int CompareTo(SmartFloat value) { if (this.IsEmpty && value.IsEmpty) { return(0); } else { return(_float.CompareTo(value.Float)); } }
/// <summary> /// Compares one SmartFloat to another. /// </summary> /// <remarks> /// This method works the same as the <see cref="int.CompareTo"/> method /// on the Float inttype, with the exception that it /// understands the concept of empty int values. /// </remarks> /// <param name="value">The int to which we are being compared.</param> /// <returns>A value indicating if the comparison int is less than, equal to or greater than this int.</returns> public int CompareTo(SmartFloat value) { if (this.IsEmpty && value.IsEmpty) return 0; else return _float.CompareTo(value.Float); }