Math.Round操作

2016-01-15 09:51:14  访问(1608) 赞(0) 踩(0)

string str = "123.123456789";

                double d = double.Parse(str);
                Response.Write(Math.Round(d, 6).ToString()+"<br />");
                Response.Write(Math.Round(d, 5).ToString() + "<br />");
                Response.Write(Math.Round(d, 1).ToString() + "<br />");
                Response.Write(Math.Round(d, 0).ToString() + "<br />");
                Response.Write(Math.Round(d, -1).ToString() + "<br />");


123.123457
123.12346
123.1
123
舍入位数必须在 0 和 15 之间(包括 0 和 15)。 参数名: digits


标签:Math.Round操作 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)