C# 四舍五入

            var  d0 =  Math.Round((0.4), MidpointRounding.AwayFromZero); //0
            var d1 = Math.Round((0.45), MidpointRounding.AwayFromZero); // 0
            var d2 = Math.Round((0.46), MidpointRounding.AwayFromZero);  // 0
            var d3 = Math.Round((0.49), MidpointRounding.AwayFromZero);  // 0
            var d4 = Math.Round((0.50), MidpointRounding.AwayFromZero); //1

 

            var d0 = Math.Round((0.4)); //0
            var d1 = Math.Round((0.45)); // 0
            var d2 = Math.Round((0.46));  // 0
            var d3 = Math.Round((0.49));  // 0
            var d4 = Math.Round((0.50)); //0

 

posted @ 2021-02-09 09:41  enych  阅读(230)  评论(0编辑  收藏  举报