Пример #1
0
        private void Normalize()
        {
            // compute greatest common divisor of numerator and denominator
            BigInteger g = Numerator.Gcd(Denominator);

            if (g.CompareTo(BigInteger.One) > 0)
            {
                Numerator   = Numerator.Divide(g);
                Denominator = Denominator.Divide(g);
            }
            if (Denominator.CompareTo(BigInteger.Zero) == -1)
            {
                Numerator   = Numerator.Negate();
                Denominator = Denominator.Negate();
            }
        }