{
string Temp;
string Temp2;
int i, j;
double ResultValue;
double Numbertemp;
Temp = Convert.ToString(number);
i = Temp.LastIndexOf(".");
if (((Temp.Length - (i + 1)) <= digits) (i == -1)) return number; Temp2 = Temp.Substring(i + digits + 1, 1); j = Convert.ToInt32(Temp2); Numbertemp = Convert.ToDouble(Temp.Substring(0, i + digits + 1)); if (j == 5) ResultValue = Numbertemp + (1 / (Math.Pow(10,digits))); else ResultValue = Math.Round(number, digits); return ResultValue; } Courtesy of
No comments:
Post a Comment