[英]Using Math.Round(ReportItems!category.Value,MidpointRounding.AwayFromZero) returns incorrect value
I am using 我在用
=Math.Round(ReportItems!category.Value,MidpointRounding.AwayFromZero)
in a tablix row, which results incorrect value. 在tablix行中,这将导致错误的值。
5.48
is rounding to 5
5.48
舍入到5
Instead, I would like to see 5.48
as 6
. 相反,我想将
5.48
视为6
。
MidpointRounding.AwayFromZero
Is a way of defining how the midpoint value is handled. MidpointRounding.AwayFromZero
是一种定义如何处理中点值的方法。 The midpoint is X.5
. 中点是
X.5
。 So, 4.5
is rounded to 5
, rather than 4
, which is what would happen in the case of MidpointRounding.ToEven
. 因此,将
4.5
舍入为5
而不是4
,这是在MidpointRounding.ToEven
情况下会发生的情况。 Round
is completely correct. Round
是完全正确的。
If you want to write a function that rounds all non-integer values to the next highest integer then that operation is Math.Ceiling
, not Round
. 如果要编写一个将所有非整数值
Math.Ceiling
入到下一个最大整数的函数,则该操作为Math.Ceiling
,而不是Round
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.