Example #1
0
        public Task <MathStatistics.DescriptiveStatistics> GetStatisticsAsync(double[] data, double a)
        {
            if (a <= 0)
            {
                return(Task.FromException <MathStatistics.DescriptiveStatistics>(new ArithmeticException()));
            }

            var result = new MathStatistics.DescriptiveStatistics(data, a);

            return(Task.FromResult(result));
        }
Example #2
0
        public Task <MathStatistics.DescriptiveStatistics> GetStatisticsAsync(string rawData, double a)
        {
            if (string.IsNullOrEmpty(rawData))
            {
                return(Task.FromException <MathStatistics.DescriptiveStatistics>(new ArgumentNullException()));
            }

            if (a <= 0)
            {
                return(Task.FromException <MathStatistics.DescriptiveStatistics>(new ArithmeticException()));
            }

            var data   = Utils.StringToNumber(rawData);
            var result = new MathStatistics.DescriptiveStatistics(data, a);

            return(Task.FromResult(result));
        }