In C#, the result of Math.Round(2.5)
is 2.
It is supposed to be 3, isn\'t it? Why is it 2 instead in C#?
From MSDN:
By default, Math.Round uses MidpointRounding.ToEven. Most people are not familiar with "rounding to even" as the alternative, "rounding away from zero" is more commonly taught in school. .NET defaults to "Rounding to even" as it is statistically superior because it doesn't share the tendency of "rounding away from zero" to round up slightly more often than it rounds down (assuming the numbers being rounded tend to be positive.)
http://msdn.microsoft.com/en-us/library/system.math.round.aspx