Rounding to even in C#
问题 I'm not seeing the result I expect with Math.Round. return Math.Round(99.96535789, 2, MidpointRounding.ToEven); // returning 99.97 As I understand MidpointRounding.ToEven, the 5 in the thousandths position should cause the output to be 99.96. Is this not the case? I even tried this, but it returned 99.97 as well: return Math.Round(99.96535789 * 100, MidpointRounding.ToEven)/100; What am I missing Thanks! 回答1: You're not actually at the midpoint. MidpointRounding.ToEven indicates that if you