2014年3月24日

C# 四舍五入

摘要: int i = int(d); //舍弃小数部分int i = Convert.ToInt32(d); //四舍六入五取偶Math.Round这个函数的解释是将值按指定的小数位数舍入,并不就是四舍五入。这种舍入有时称为就近舍入或四舍六入五成双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... 阅读全文

posted @ 2014-03-24 17:26 RickyZ 阅读(427) 评论(0) 推荐(0)

导航