Exemple #1
0
        static void WriteDoubleResults(TextWriter tw, string arrayName, double[] results, int count, string func)
        {
            tw.WriteLine("  {0}: array[0.. TestCount - 1] of Double =", arrayName);
            tw.WriteLine("  (");

            for (int i = 0; i < count; ++i)
            {
                double d      = results[i];
                string result = DoubleConverter.ToExactString(d);
                result = (i < count - 1) ? result + "," : result;
                tw.WriteLine("    {0,-76}// {1}(Arguments[{2}])", result, func, i);
            }
            tw.WriteLine("  );");
            tw.WriteLine();
        }
Exemple #2
0
        static void GenerateLnResults(TextWriter tw)
        {
            int count = testData.Length;

            double[] results = new double[count];

            for (int i = 0; i < count; ++i)
            {
                BigInteger b1 = BigInteger.Parse(testData[i]);
                results[i] = BigInteger.Log(b1);
            }

            WriteDoubleResults(tw, "LnResults", results, count, "Ln");

            BigInteger b  = BigInteger.Pow(1000, 1000);
            double     d1 = BigInteger.Log(b);
            double     d2 = BigInteger.Log10(b);
            double     d3 = BigInteger.Log(b, 2.0);

            tw.WriteLine("  Ln_1000_1000    = {0};", DoubleConverter.ToExactString(d1));
            tw.WriteLine("  Log10_1000_1000 = {0};", DoubleConverter.ToExactString(d2));
            tw.WriteLine("  Log2_1000_1000  = {0};", DoubleConverter.ToExactString(d3));
            tw.WriteLine();
        }