Click or drag to resize
MathRound Method (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.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static double Round(
	double value,
	int digits,
	MidpointRounding mode
)

Parameters

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

Return Value

Type: Double
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.
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptiondigits is less than 0 or greater than 15.
ArgumentExceptionmode is not a valid value of MidpointRounding.
See Also