How would I round to the nearest 5000 in vb.net. Can’t use math.round cause it gives error. I’m looking for something like mround() in microsoft exel.
Math.round(43333 * 34, 5000)
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.
Try
As in:
Outputs:
I’ll add that the default rounding behavior for
Math.RoundisMidpointRounding.ToEvenwhich the documentation describes as “When a number is halfway between two others, it is rounded toward the nearest even number.” This means that0.5may be rounded to0or1depending on the circumstances (which is the desired behavior when dealing with statistics). To change this behavior, you can passMidpointRounding.AwayFromZeroas the second parameter, which will behave as you were taught in school (0.5always rounds to1,-0.5always rounds to-1).