Rhino.ScriptRuntime.NumberToString C# (CSharp) Method

NumberToString() public static method

public static NumberToString ( double d, int @base ) : string
d double
@base int
return string
		public static string NumberToString(double d, int @base)
		{
			if (d != d)
			{
				return "NaN";
			}
			if (d == double.PositiveInfinity)
			{
				return "Infinity";
			}
			if (d == double.NegativeInfinity)
			{
				return "-Infinity";
			}
			if (d == 0.0)
			{
				return "0";
			}
			if ((@base < 2) || (@base > 36))
			{
				throw Context.ReportRuntimeError1("msg.bad.radix", Sharpen.Extensions.ToString(@base));
			}
			if (@base != 10)
			{
				return DToA.JS_dtobasestr(@base, d);
			}
			else
			{
				// V8 FastDtoa can't convert all numbers, so try it first but
				// fall back to old DToA in case it fails
				string result = FastDtoa.NumberToString(d);
				if (result != null)
				{
					return result;
				}
				StringBuilder buffer = new StringBuilder();
				DToA.JS_dtostr(buffer, DToA.DTOSTR_STANDARD, 0, d);
				return buffer.ToString();
			}
		}
ScriptRuntime