I\'ve noticed the following inconsistency in C#/.NET. I was wondering why it is so.
Console.WriteLine(\"{0,-4:#.0} | {1,-4:#.0}\", 1.04, Math.Round(1.04, 1)
Seems this problem is worse than a "simple" inconsistency:
double dd = 0.034999999999999996;
Math.Round(dd, 2); // 0.03
Math.Round(dd, 2, MidpointRounding.AwayFromZero); // 0.03
Math.Round(dd, 2, MidpointRounding.ToEven); // 0.03
string.Format("{0:N2}", dd); // "0.04"
This is absolutely bananas. Who knows where the heck it get "0.04" from.