2 out of 5 rated this helpful - Rate this topic

Math.Round Method

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

Name Description
Math.Round (Decimal) Rounds a decimal value to the nearest integer.

Supported by the .NET Compact Framework.

Math.Round (Double) Rounds a double-precision floating-point value to the nearest integer.

Supported by the .NET Compact Framework.

Math.Round (Decimal, Int32) Rounds a decimal value to a specified precision.

Supported by the .NET Compact Framework.

Math.Round (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.
Math.Round (Double, Int32) Rounds a double-precision floating-point value to the specified precision.

Supported by the .NET Compact Framework.

Math.Round (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.
Math.Round (Decimal, Int32, MidpointRounding) Rounds a decimal value to a specified precision. A parameter specifies how to round the value if it is midway between two other numbers.
Math.Round (Double, Int32, MidpointRounding) Rounds a double-precision floating-point value to the specified precision. A parameter specifies how to round the value if it is midway between two other numbers.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
default behaviour differs from sql server
If you use Math.Round(decimal, precision) and the T-SQL Round() function the default behaviour in Math.Round differs in that it uses the "round to even" type rounding whereas T-SQL Round() always rounds from zero.
e.g. Math.Round(22.225, 2) = 22.22 T-SQL.Round(22.225, 2) = 22.23
to get them to work the same use Math.Round(22.225, 2, MidpointRounding.AwayFromZero)