2
Answers

Rounding Decimals

Photo of Jay

Jay

15y
4.2k
1

Hi Everyone,
I am trying to round a decimal point.  I have a decimal with a value of 6.365, and I want to round this decimal to 6.37, but when I use  Math.Round(decimal, 2), I get 6.36 instead of it rounding up to 6.37.  Any suggestions?  Any help will be greatly appreciated.  Thanks in advance.
Jay

Answers (2)

0
Photo of Roei Bar
NA 7.8k 0 15y
Use the MidPoint Overload

Math.Round(6.365, 0, MidpointRounding.AwayFromZero); will give 3.37

Accepted
0
Photo of Jay
NA 48 0 15y

Awsome...Thanks for your help!
Jay