Pchp.Library.PhpMath.BaseToDouble C# (CSharp) Method

BaseToDouble() private static method

private static BaseToDouble ( string number, int fromBase ) : double
number string
fromBase int
return double
        private static double BaseToDouble(string number, int fromBase)
        {
            if (number == null)
            {
                //PhpException.ArgumentNull("number");
                //return 0.0;
                throw new ArgumentException();
            }

            if (fromBase < 2 || fromBase > 36)
            {
                //PhpException.InvalidArgument("toBase", LibResources.GetString("arg:out_of_bounds"));
                //return 0.0;
                throw new ArgumentException();
            }

            double fnum = 0;
            for (int i = 0; i < number.Length; i++)
            {
                int digit = Core.Convert.AlphaNumericToDigit(number[i]);
                if (digit < fromBase)
                    fnum = fnum * fromBase + digit;
            }

            return fnum;
        }