public void SetSeconds(decimal sec) { this.Seconds = Rational <uint> .Approximate(sec); }
public void SetDegrees(decimal deg) { this.Degrees = Rational <uint> .Approximate(deg); }
public void SetMinutes(decimal min) { this.Minutes = Rational <uint> .Approximate(min); }
/// <summary> /// Approximate the decimal value accurate to a precision of 0.000001m /// </summary> /// <param name="value">decimal value to approximate</param> /// <returns>an approximation of the value as a rational number</returns> /// <remarks> /// http://stackoverflow.com/questions/95727 /// </remarks> public static Rational<T> Approximate(decimal value) { return Rational<T>.Approximate(value, 0.000001m); }