Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
System Namespace
Math Class
Math Methods
Round Method

  Switch on low bandwidth view
Members FilterMembers Filter
Frameworks FilterFrameworks Filter
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
Math..::.Round Method

Rounds a value to the nearest integer or specified number of decimal places.

  NameDescription
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkRound(Decimal)Rounds a decimal value to the nearest integral value.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkRound(Double)Rounds a double-precision floating-point value to the nearest integral value.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkRound(Decimal, Int32)Rounds a decimal value to a specified number of fractional digits.
Public methodStatic memberRound(Decimal, MidpointRounding)Rounds a decimal value to the nearest integer. A parameter specifies how to round the value if it is midway between two other numbers.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkRound(Double, Int32)Rounds a double-precision floating-point value to a specified number of fractional digits.
Public methodStatic memberRound(Double, MidpointRounding)Rounds a double-precision floating-point value to the nearest integer. A parameter specifies how to round the value if it is midway between two other numbers.
Public methodStatic memberRound(Decimal, Int32, MidpointRounding)Rounds a decimal value to a specified number of fractional digits. A parameter specifies how to round the value if it is midway between two other numbers.
Public methodStatic memberRound(Double, Int32, MidpointRounding)Rounds a double-precision floating-point value to the specified number of fractional digits. A parameter specifies how to round the value if it is midway between two other numbers.
Top
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Default Rounding Method      Jackerran ... DoomGoober   |   Edit   |   Show History
By default, Math.Round uses MidpointRounding.ToEven. Most people are not familiar with "rounding to even" as the alternative, "rounding away from zero" is more commonly taught in school. .NET defaults to "Rounding to even" as it is statistically superior because it doesn't share the tendency of "rounding away from zero" to round up slightly more often than it rounds down (assuming the numbers being rounded tend to be positive.)
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker