// BY: bit.Aipeli 2005-11-07 23:27:23 private double Round( double v, int x) { int i; long IValue=1; double DValue=1; for (i=1;i<=x;i++) { IValue=IValue*10; DValue=DValue/10; } long Int=(long)Decimal.Round(Convert.ToDecimal(v*IValue),0); double Key=(double)(v/DValue)-Int; double Dou=(double)Int/IValue; if (Key>=0.5) { Dou+=DValue; } return Dou; }
本代码在:Windows 2003 && Microsoft Visual Studio .NET 2003 通过