Exemplo n.º 1
0
        public static void TestBinaryOperation(BinaryOp op)
        {
            PrecisionResult precision = TestBinaryPrecision(op);
            BenchmarkResult benchmark = BenchmarkBinaryOperation(op);

            PrintOperationSummary(op.name, precision, benchmark);
        }
Exemplo n.º 2
0
        public static void PrintOperationSummary(string name, PrecisionResult precision, BenchmarkResult benchmark)
        {
            if (benchmark.elapsedSeconds < 0.1 || benchmark.elapsedSeconds > 1.0)
            {
                Console.WriteLine("WARNING: {0} took {1:0.00}s to execute, tweak its iteration count so that it executes in roughly 0.5s", name, benchmark.elapsedSeconds);
            }

            if (precision.maxError == 0.0)
            {
                Console.WriteLine("| {0,16} | {1,10:0.0000} |     exact | {2,16} | {3,16} |", name, benchmark.opsPerSec / 1000000.0, "0.0", "0.0");
            }
            else
            {
                string coordsStr = String.Join(" ", precision.worstInput.Select(v => DoubleToString(v.Double, 16)));
                Console.WriteLine("| {0,16} | {1,10:0.0000} | {2,9:0.00} | {3} | {4} | {5}", name, benchmark.opsPerSec / 1000000.0, precision.numPrecisionBits, DoubleToString(precision.avgError, 16), DoubleToString(precision.maxError, 16), coordsStr);
            }
        }