Пример #1
0
        public static Fractional operator *(Fractional A, Fractional B)
        {
            Fractional Result = new Fractional();

            Result.small = A.small * B.small;
            Result.hight = (A.hight * B.hight);
            Result.ReduceFraction();

            return(Result);
        }
Пример #2
0
        public static Fractional operator /(Fractional A, Fractional B)
        {
            bool isPlusA = A.hight > 0 ? true : false;
            bool isPlusB = B.hight > 0 ? true : false;

            A.hight = Math.Abs(A.hight);
            B.hight = Math.Abs(B.hight);

            Fractional Result = new Fractional();


            Result.hight = (A.hight * B.small);
            Result.small = A.small * B.hight;

            if (isPlusA != isPlusB)
            {
                Result.hight = -Result.hight;
            }

            Result.ReduceFraction();

            return(Result);
        }