コード例 #1
0
        public SquareRoot CountRoot()
        {
            var root = new SquareRoot();

            if (Delta == 0)
            {
                root.Root = -ParameterB / (2 * ParameterA);
            }
            else
            {
                throw new ArgumentException("This method is dedicated for one square functions. Delta should be equal to 0");
            }
            return(root);
        }
コード例 #2
0
        public SquareRoot CountRoot(bool operand)
        {
            var root = new SquareRoot();

            if (Delta != 0 && Delta > 0)
            {
                if (operand == true)
                {
                    root.Root = Math.Round((-ParameterB + Math.Sqrt(Delta)) / (2 * ParameterA), 2);
                }
                else
                {
                    root.Root = Math.Round((-ParameterB - Math.Sqrt(Delta)) / (2 * ParameterA), 2);
                }
            }
            else
            {
                throw new ArgumentException("This method is dedicated for two square functions. Delta should be above 0");
            }
            return(root);
        }