Esempio n. 1
0
        public void TestSplitDouble()
        {
            double      x           = double.Parse("12.012345678901234");
            DComponents dComponents = new DComponents(x);

            double splitMult = Math.Pow(2, 25) + 1.0;

            double temp = x * splitMult;

            double hi = temp - (temp - x);
            double lo = x - hi;

            string s1 = dComponents.ToBase2String(true);
            string s2 = new DComponents(hi).ToBase2String(true);
            string s3 = new DComponents(lo).ToBase2String(true);
        }
Esempio n. 2
0
        public void TestCreateFp()
        {
            double One256th  = 0.00390625;
            double One1024th = Math.Pow(2, -10);

            double t = 12;

            t += One256th;
            t += One1024th;

            Fp a = new Fp(t);

            a.ReportDigitsBin();

            double      tc  = a.GetDouble();
            DComponents dtc = new DComponents(tc);

            Debug.WriteLine($"The recombined value is {dtc.ToBase2String(false)}, (Decimal: {tc}).");
        }
Esempio n. 3
0
 public void TestDComponents()
 {
     DComponents t   = new DComponents(8);
     string      st1 = t.ToBase2String(true);
     string      st2 = t.ToBase2String(false);
 }