Midpoint Round in C#





1
Date Submitted Fri. Mar. 20th, 2009 1:41 AM
Revision 1 of 1
Scripter mycodeofshailendra
Tags CSharp
Comments 0 comments
Rounding in C#


double num = Math.Round(3.45, 0, MidpointRounding.AwayFromZero);
// output  is 3.0
double num = Math.Round(3.55, 0, MidpointRounding.AwayFromZero);
// output  is 4.0

double num = Math.Round(3.45, 1, MidpointRounding.AwayFromZero);
// output  is 3.5

double num = Math.Round(3.55, 1, MidpointRounding.AwayFromZero);
// output  is 3.6
 

shailendra bhadange

shailendra-problemsolution.blogspot.com/
Shailendra Bhadange

Comments

There are currently no comments for this snippet.

Voting

Votes Up


Scripter elsevero

Votes Down