示例#1
0
        public void TestMultiply()
        {
            double One16th   = Math.Pow(2, -4);
            double One256th  = Math.Pow(2, -8);
            double One1024th = Math.Pow(2, -10);

            double t = 4;

            t += 3 * One16th;
            t += 2 * One256th;
            t += One1024th;

            Fp a = new Fp(t);

            a.ReportDigitsBin();

            double t2 = 2;

            t2 += 2 * One16th;
            t2 += One256th;
            t2 += One1024th;

            Fp b = new Fp(t2);

            b.ReportDigitsBin();

            Fp p = Fp.Mul(a, b);
        }
示例#2
0
        public void TestMultiplyER()
        {
            double t = 1.000123456;
            Fp     a = new Fp(t);

            a.ReportDigitsBin();

            double t2 = 1.00278654;
            Fp     b  = new Fp(t2);

            b.ReportDigitsBin();

            for (int i = 0; i < 100; i++)
            {
                Fp p = Fp.Mul(a, b);
                a = new Fp(p);
                a.ReportDigitsBin();

                t = t * t2;
            }


            double t3 = t * t2;
            Fp     c  = new Fp(t3);

            c.ReportDigitsBin();
        }
示例#3
0
        public void TestMultiplyR()
        {
            double t = 4.34432;
            Fp     a = new Fp(t);

            a.ReportDigitsBin();

            double t2 = 2.89967;
            Fp     b  = new Fp(t2);

            b.ReportDigitsBin();

            Fp p = Fp.Mul(a, b);

            p.ReportDigitsBin();

            double t3 = t * t2;
            Fp     c  = new Fp(t3);

            c.ReportDigitsBin();
        }