Why Round like this?
-
From the docs the definition of Math.Round The integer nearest a. If a is halfway between two integers, one of which is even and the other odd, then the even number is returned. So 4.5 rounds to 4 and 3.5 rounds to 4. Why?
Because it uses the Banker's Rounding algorithm to do the rounding. It's overrideable so you can use your own round method(s).
-
From the docs the definition of Math.Round The integer nearest a. If a is halfway between two integers, one of which is even and the other odd, then the even number is returned. So 4.5 rounds to 4 and 3.5 rounds to 4. Why?
I forgot to post the link with my previous post: http://en.wikipedia.org/wiki/Rounding[^]
-
From the docs the definition of Math.Round The integer nearest a. If a is halfway between two integers, one of which is even and the other odd, then the even number is returned. So 4.5 rounds to 4 and 3.5 rounds to 4. Why?