111,075
社区成员




Convert.ToInt32(3.5); //4
Convert.ToInt32(-3.5); //-4
Convert.ToInt32(4.5); //4
Convert.ToInt32(-4.5); //-4
double a = 2.3;
double b = 4.5;
Response.Write("a:"+a.ToString("0")+"<br>");
Response.Write("b:"+b.ToString("0"));
------------
a:2
b:5
Math.Round(0.4) //result:0
Math.Round(0.6) //result:1
Math.Round(0.5) //result:0
Math.Round(1.5) //result:2
Math.Round(2.5) //result:2
Math.Round(3.5) //result:4
Math.Round(5.5) //result:6
Math.Round(6.5) //result:6
Math.Round(8.5) //result:8
Math.Round(9.5) //result:10
//四舍五入
Math.Round(0.5,MidpointRounding.AwayFromZero)