private bool Equals(Rational other) => Denominator == other.Denominator && Numerator == other.Numerator;
public static double?DegreesMinutesSecondsToDecimal(Rational degs, Rational mins, Rational secs, bool isNegative) { var value = Math.Abs(degs.ToDouble()) + mins.ToDouble() / 60.0d + secs.ToDouble() / 3600.0d; if (double.IsNaN(value)) { return(null); } if (isNegative) { value *= -1; } return(value); }
public static bool TryGetRational([NotNull] this Directory directory, int tagType, out Rational value) { var o = directory.GetObject(tagType); if (o == null) { value = default(Rational); return(false); } if (o is Rational r) { value = r; return(true); } if (o is int i) { value = new Rational(i, 1); return(true); } if (o is long l) { value = new Rational(l, 1); return(true); } // NOTE not doing conversions for real number types value = default(Rational); return(false); }