Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
MidPointRounding for Math.Round() method in .Net Application
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
eliza sahoo
14y
6.6k
1
Reply
We all know Math.Round() basically rounds a particular decimal value. But if we look into this method closely it rounds the value to the nearest even value.
For example if we do
Math
.Round(2.5,0) it will return 2. But we may expect 3 intead of 2. In that case we can use MidPointRounding parameter of
Math.Round() method.
Math.Round can also take a parameter known as
MidPointRounding
which helps us to select the Rounding option. That means whether we want to round towards even number or to the number away from zero.
For example, when someone do the rounding of 8.5 .
MidpointRounding
will help to specify whether rounding will be towards the even number (8) or it will be away from zero (9).
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Send email through the proxy server?
how to call a static function of class Form?