The round function in C# is not actually a real rounding function, and the round function in general programming languages is not a rounding function, but a banker's rounding method function, that is, "round up to five, then five is not If zero is zero, add one. If the last five is zero, look at the odd or even number. If the first five is even, discard it. If the first five is odd, add one."
using System; public class Example { public static void Main() { double[] values = { 2.125, 2.135, 2.145, 3.125, 3.135, 3.145 }; foreach (double value in values) Console.WriteLine("{0} --> {1}", value, Math.Round(value, 2, MidpointRounding.AwayFromZero)); } } // The example displays the following output: // 2.125 --> 2.13 // 2.135 --> 2.13 // 2.145 --> 2.15 // 3.125 --> 3.13 // 3.135 --> 3.14 // 3.145 --> 3.15