以下是一些示例:
decimal a = 1.994444M;
Math.Round(a, 2); //returns 1.99
decimal b = 1.995555M;
Math.Round(b, 2); //returns 2.00
您可能还想查看具有以下超载的银行家四舍五入/四舍五入:
Math.Round(a, 2, MidpointRounding.ToEven);
还有更多关于它的信息here http://en.wikipedia.org/wiki/Rounding#Round-to-even_method.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)