コード例 #1
0
        /// <summary>
        /// Get the minimum fraction
        /// </summary>
        /// <param name="num">The numerator</param>
        /// <param name="den">The denominator</param>
        private void GetMinFraction(ref long num, ref long den)
        {
            FactorFinder f1 = new FactorFinder(num),
                         f2 = new FactorFinder(den);

            f1.Find(true);
            f2.Find(true);
            double val = 1;

            foreach (var v in f1.Factors.Intersect(f2.Factors))
            {
                val *= v;
            }
            num = (int)((double)num / val);
            den = (int)((double)den / val);
        }