コード例 #1
0
ファイル: fib_loop.cs プロジェクト: JCash/languagetests
    public static void Main(string[] args)
    {
        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

        ulong iterations = args.Length > 0 ? Convert.ToUInt64(args[0]) : 100;
        ulong n = args.Length > 1 ? Convert.ToUInt64(args[1]) : 10;

        Timeit timeit = new Timeit();
        BigInteger result = timeit.Run<ulong, BigInteger>(iterations, Fibonacci, n);

        Reporter.write_result(Console.OpenStandardOutput(),
                                String.Format("Fibonacci (recursive) n = {0}", n),
                                iterations,
                                timeit.Average,
                                timeit.Mean,
                                timeit.Min,
                                timeit.Max,
                                String.Format("{0}", result) );
    }
コード例 #2
0
ファイル: fact_recursive.cs プロジェクト: JCash/languagetests
    public static void Main(string[] args)
    {
        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

        ulong iterations = args.Length > 0 ? Convert.ToUInt64(args[0]) : 100;
        ulong n          = args.Length > 1 ? Convert.ToUInt64(args[1]) : 40;

        Timeit     timeit = new Timeit();
        BigInteger result = timeit.Run <ulong, BigInteger>(iterations, Factorial, n);

        Reporter.write_result(Console.OpenStandardOutput(),
                              String.Format("Factorial (recursive) n = {0}", n),
                              iterations,
                              timeit.Average,
                              timeit.Mean,
                              timeit.Min,
                              timeit.Max,
                              String.Format("{0}", result));
    }