Question: How do you Round Down the number to the nearest decimal point in C#? the number I want to round down is 0.7777777777777777771, when I round use
Math.Round(MyNumber,02) the answer is 0.78. I don't want this answer, I wanted 0.77.
How do you do that with Math.Round() Method?
Answer: See the code below:
decimal myRoundDownValue = Math.Round(MyNumber,2,MidpointRounding.ToNegativeInfinity); //Answer myRoundDownValue will be the actual value rounded to two decimal places.
Using the Math.Round(MyNumber,2,MidpointRounding.ToNegativeInfinity); will round down the value to two decimal places. According to Visual Studio Intellisense, the MidpointRounding.ToNegativeInfinity enum rounds down with the result closest to and no greater than the infinitely precise result.