Пример #1
0
        /// <summary>
        /// Internal Add Method after numbers already converted.
        /// </summary>
        /// <param name="Left"></param>
        /// <param name="Right"></param>
        /// <returns></returns>
        internal static BigMathNumber Add(BigMathNumber Left, BigMathNumber Right)
        {
            List <sbyte> left   = Left.internalNumber;
            List <sbyte> right  = Right.internalNumber;
            List <sbyte> answer = Add(left, right);

            BigMathNumber theAnswer = new BigMathNumber();

            theAnswer.internalNumber = answer;
            return(theAnswer);
        }
Пример #2
0
        internal static BigMathNumber Exponential(BigMathNumber BaseNumber, BigMathNumber Exponent)
        {
            List <sbyte> baseNumber = BaseNumber.internalNumber;
            List <sbyte> exponent   = Exponent.internalNumber;
            List <sbyte> answer     = Exponential(baseNumber, exponent);

            BigMathNumber theAnswer = new BigMathNumber();

            theAnswer.internalNumber = answer;
            return(theAnswer);
        }
Пример #3
0
        /// <summary>
        /// Returns the result of BaseNumber^Exponent
        /// </summary>
        /// <param name="BaseNumber"></param>
        /// <param name="Exponent"></param>
        /// <returns></returns>
        public static String Exponential(String BaseNumber, String Exponent)
        {
            var baseNumber = new BigMathNumber();
            var exponent   = new BigMathNumber();

            baseNumber.SetValue(BaseNumber);
            exponent.SetValue(Exponent);
            var answer      = BigMathHelper.Exponential(baseNumber, exponent);
            var returnValue = answer.ToString();

            return(returnValue);
        }
Пример #4
0
        /// <summary>
        /// Returns quotient of Dividend / Devisor
        /// </summary>
        /// <param name="Dividend"></param>
        /// <param name="Devisor"></param>
        /// <returns></returns>
        public static String Divide(String Dividend, String Devisor)
        {
            var leftNumber  = new BigMathNumber();
            var rightNumber = new BigMathNumber();

            leftNumber.SetValue(Dividend);
            rightNumber.SetValue(Devisor);

            var answer = leftNumber / rightNumber;

            var answerResponse = answer.ToString();

            return(answerResponse);
        }
Пример #5
0
        /// <summary>
        /// Returns the Product of Left * Right
        /// </summary>
        /// <param name="Left"></param>
        /// <param name="Right"></param>
        /// <returns></returns>
        public static String Multiply(String Left, String Right)
        {
            var leftNumber  = new BigMathNumber();
            var rightNumber = new BigMathNumber();

            leftNumber.SetValue(Left);
            rightNumber.SetValue(Right);

            var answer = leftNumber * rightNumber;

            var answerResponse = answer.ToString();

            return(answerResponse);
        }
Пример #6
0
        internal static BigMathNumber ConvertStringToBigMathNumber(string number)
        {
            var newBigMathNumber = new BigMathNumber();

            //is the number negative?
            //is the number only a number?
            //does the number contain a decimal?
            if (IsNumeric(number))
            {
                newBigMathNumber.SetValue(number);
            }
            else
            {
                throw new System.ArgumentOutOfRangeException("Value provided is not a valid Number");
            }
            return(newBigMathNumber);
        }