四舍五入

        double num = 2600 * 0.001;
            double x = Math.Round(2.4, MidpointRounding.AwayFromZero); //结果为2
            Console.WriteLine(x);
             x = Math.Round(2.5, MidpointRounding.AwayFromZero); //结果为3
            Console.WriteLine(x);
            x = Math.Round(2.6, MidpointRounding.AwayFromZero); //结果为3
            Console.WriteLine(x);

 

posted @ 2019-08-26 09:21  sunshuaize  阅读(142)  评论(0编辑  收藏  举报