ReportViewer Round() 函数
我目前正在使用 VS2005 + 报表查看器,想知道是否有一种方法可以强制报表查看器在小数为 0.5+ 时向上舍入,因为目前似乎它向下舍入到“.5”,然后向上舍入到“ .6" 例如。
Round(20.5,0) //Returns 20
Round(20.6,0) //Returns 21
奇怪的是,这些就是我得到的结果(我发誓它应该四舍五入为 0.5,至少这是我在小学所教的......)
无论如何,如果有人知道我如何配置这个问题或强制它四舍五入关于这一点,请让我知道任何帮助,谢谢!
I am currently working with VS2005 + reportviewer and was wondering if there is a way to force report viewer to round up when the decimal is .5+ because currently it seems as if it rounds down until ".5" and then rounds up at ".6" for eg.
Round(20.5,0) //Returns 20
Round(20.6,0) //Returns 21
Strangely enough those are the results i get (I swear its supposed to round up at .5, atleast thats what i was taught in elementary school...)
Anyways if anyone knows how i can configure this issue or force it to round up at this point please let me know any help is appreciated thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 Round(20.5, System.MidPointRounding.AwayFromZero) 代替
Use
Round(20.5, System.MidPointRounding.AwayFromZero)
instead