예제 #1
0
        public void AtanTest(double argument, double result)
        {
            var calculator = new Atan();
            var testResult = calculator.Calculate(argument);

            Assert.AreEqual(result, testResult);
        }
예제 #2
0
        public void AtanTest(double first, double second, double expected)
        {
            ITwoArgumentsCalculator calculator = new Atan();
            double result = calculator.Calculate(first, second);

            Assert.AreEqual(expected, result);
        }
예제 #3
0
        public void Go()
        {
            var stopwatch = Stopwatch.StartNew();

            HighPrecision.Precision = _dp;
            HighPrecision first  = 4 * Atan.Calculate(5);
            HighPrecision second = Atan.Calculate(239);

            var pi = 4 * (first - second);

            stopwatch.Stop();

            WriteLine($"I calculated Pi to {_dp} decimal places in {stopwatch.ElapsedMilliseconds}ms. The last digit is {pi.ToString().Last()}.");
        }
예제 #4
0
        public IActionResult Index(int?dp = 6)
        {
            var stopwatch = Stopwatch.StartNew();

            HighPrecision.Precision = dp.Value;
            HighPrecision first  = 4 * Atan.Calculate(5);
            HighPrecision second = Atan.Calculate(239);

            var pi = 4 * (first - second);

            var model = new PiModel
            {
                DecimalPlaces       = dp.Value,
                Value               = pi.ToString(),
                ComputeMilliseconds = stopwatch.ElapsedMilliseconds,
                ComputeHost         = Environment.MachineName
            };

            return(View(model));
        }