C#中 decimal 的四舍五入 – TooKoo – 博客园

来源: C#中 decimal 的四舍五入 – TooKoo – 博客园

当:decimal sum = 123456.784M;

sum = decimal.Round(sum, 2 , MidpointRounding.AwayFromZero);

sum 的值为:123456.78

当:decimal sum = 123456.785M;

sum = decimal.Round(sum, 2 , MidpointRounding.AwayFromZero);

sum 的值为:123456.79

分享到:更多 ()