コード例 #1
0
        public double RunDoubleDouble(int nIter)
        {
            var sw = new Stopwatch();

            sw.Start();
            for (int i = 0; i < nIter; i++)
            {
                var a      = new DD(9.0);
                var factor = new DD(10.0);
                var aMul   = factor.Multiply(a);
                var aDiv   = a.Divide(factor);

                var det = a.Multiply(a)
                          .Subtract(aMul.Multiply(aDiv));
                // Console.WriteLine(aDiv);
                // Console.WriteLine(det);
            }
            sw.Stop();
            Console.WriteLine("DD:              nIter = " + nIter
                              + "   time = " + sw.ElapsedMilliseconds);
            return(sw.ElapsedMilliseconds / (double)nIter);
        }
コード例 #2
0
        private static void CheckDivideMultiply(DD a, DD b, double errBound)
        {
            DD a2 = a.Divide(b).Multiply(b);

            CheckErrorBound("DivideMultiply", a, a2, errBound);
        }
コード例 #3
0
        public double RunDoubleDouble(int nIter)
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            for (int i = 0; i < nIter; i++)
            {

                DD a = new DD(9.0);
                DD factor = new DD(10.0);
                DD aMul = factor.Multiply(a);
                DD aDiv = a.Divide(factor);

                DD det = a.Multiply(a)
                    .Subtract(aMul.Multiply(aDiv));
                //      Console.WriteLine(aDiv);
                //      Console.WriteLine(det);
            }
            sw.Stop();
            Console.WriteLine("DD:              nIter = " + nIter
                              + "   time = " + sw.ElapsedMilliseconds);
            return sw.ElapsedMilliseconds/(double) nIter;
        }
コード例 #4
0
 private static void CheckDivideMultiply(DD a, DD b, double errBound)
 {
     DD a2 = a.Divide(b).Multiply(b);
     CheckErrorBound("DivideMultiply", a, a2, errBound);
 }