Pchp.Library.PhpMath.DoubleToBase C# (CSharp) Метод

DoubleToBase() приватный статический Метод

private static DoubleToBase ( double number, int toBase ) : string
number double
toBase int
Результат string
        private static string DoubleToBase(double number, int toBase)
        {
            if (toBase < 2 || toBase > 36)
            {
                throw new NotImplementedException();
                //PhpException.InvalidArgument("toBase", LibResources.GetString("arg:out_of_bounds"));
                //return String.Empty;
            }

            // Don't try to convert infinity or NaN:
            if (Double.IsInfinity(number) || Double.IsNaN(number))
            {
                throw new NotImplementedException();
                //PhpException.InvalidArgument("number", LibResources.GetString("arg:out_of_bounds"));
                //return String.Empty;
            }

            double fvalue = Math.Floor(number); /* floor it just in case */
            if (Math.Abs(fvalue) < 1) return "0";

            StringBuilder sb = new StringBuilder();
            while (Math.Abs(fvalue) >= 1)
            {
                double mod = fmod(fvalue, toBase);
                int i = (int)mod;
                char c = digitsUnicode[i];
                //sb.Append(digits[(int) fmod(fvalue, toBase)]);
                sb.Append(c);
                fvalue /= toBase;
            }

            return Strings.strrev(sb.ToString());
        }