コード例 #1
0
ファイル: Rational.cs プロジェクト: twobob/exif-utils.net
		/// <summary>
		/// Finds the greatest common divisor and reduces the fraction by this amount.
		/// </summary>
		/// <returns>the reduced rational</returns>
		public Rational<T> Reduce()
		{
			T numerator = this.numerator;
			T denominator = this.denominator;

			Rational<T>.Reduce(ref numerator, ref denominator);

			return new Rational<T>(numerator, denominator);
		}
コード例 #2
0
ファイル: Rational.cs プロジェクト: twobob/exif-utils.net
		/// <summary>
		/// Ctor
		/// </summary>
		/// <param name="numerator">The numerator of the rational number.</param>
		/// <param name="denominator">The denominator of the rational number.</param>
		/// <param name="reduce">determines if should reduce by greatest common divisor</param>
		public Rational(T numerator, T denominator, bool reduce)
		{
			this.numerator = numerator;
			this.denominator = denominator;

			if (reduce)
			{
				Rational<T>.Reduce(ref this.numerator, ref this.denominator);
			}
		}