System.Math.Round Method

Rounds a double-precision floating-point value to a specified number of fractional digits. A parameter specifies how to round the value if it is midway between two numbers.

Syntax

public static double Round (double value, int digits, MidpointRounding mode)

Parameters

value
A double-precision floating-point number to be rounded.
digits
The number of fractional digits in the return value.
mode
Specification for how to round value if it is midway between two other numbers.

Returns

The number nearest to value that has a number of fractional digits equal to digits. If value has fewer fractional digits than digits, value is returned unchanged.

Remarks

Note:

For examples and comprehensive usage information about this and other overloads of the Round method, see the erload:System.Math.Round reference page.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0