Esempio n. 1
0
        public static CountSystem operator *(CountSystem inCSfirst, CountSystem inCSsecond)
        {
            CountSystem TestCS = new CountSystem(inCSfirst.myOrder);


            CountSystem retCS = new CountSystem(inCSfirst.myOrder);

            CountSystem inSecond = inCSsecond;

            if (inCSfirst.myOrder != inCSsecond.myOrder)
            {
                inSecond = GetNewOrder(inCSfirst.myOrder, inCSsecond);
            }

            for (int i = 0; i < inSecond.MyValue.Count; ++i)
            {
                TestCS.SetValue(inCSfirst);

                for (int ii = 0; ii < TestCS.MyValue.Count; ++ii)
                {
                    TestCS.MyValue[ii] *= inSecond.MyValue[i];
                }

                TestCS.Normalize();

                TestCS.SelfTenPow(i);

                retCS.SelfSum(TestCS);
            }

            return(retCS);
        }
Esempio n. 2
0
        public void SelfMul(CountSystem inCS)
        {
            CountSystem TestCS = new CountSystem(myOrder);


            CountSystem retCS = new CountSystem(myOrder);

            CountSystem inSecond = inCS;

            if (myOrder != inCS.myOrder)
            {
                inSecond = GetNewOrder(myOrder, inCS);
            }

            for (int i = 0; i < inSecond.MyValue.Count; ++i)
            {
                TestCS.SetValue(this);

                for (int ii = 0; ii < TestCS.MyValue.Count; ++ii)
                {
                    TestCS.MyValue[ii] *= inSecond.MyValue[i];
                }

                TestCS.Normalize();

                TestCS.SelfTenPow(i);

                retCS.SelfSum(TestCS);
            }

            MyValue = retCS.MyValue;
        }
Esempio n. 3
0
        public static CountSystem GetNewOrder(int inOrder, CountSystem inCS)
        {
            if (inOrder > 45000)
            {
                inOrder = 45000;
            }
            if (inOrder < 2)
            {
                inOrder = 2;
            }

            CountSystem newOne = new CountSystem(inOrder);

            CountSystem retCS = new CountSystem(inOrder);

            for (int i = 0; i < inCS.MyValue.Count; ++i)
            {
                newOne.MyValue.Clear();

                newOne.MyValue.Add(inCS.MyValue[i]);

                for (int ii = 0; ii < i; ++ii)
                {
                    newOne.MultByInt(inCS.myOrder);
                }

                retCS.SelfSum(newOne);
            }

            return(retCS);
        }