Ceiling rounds up no matter if you get .1, .3, .5, .7. or whatever the value is for the decimal.
I need to know how to only round up if you have .5. So for example [number].5 round up.
Anyone know how to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Math.Round()uses banker’s rounding by default, so it will round to the nearest even number when dealing with[number].5. In other words,Math.Round(0.5)is 0, whileMath.Round(1.5)is 2. You can make it always round up by sayingMath.Round(0.5, MidpointRounding.AwayFromZero);