Round Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Rounds a double-precision floating-point value to the nearest integral value.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public static double Round(
	double d


Type: System..::..Double
A double-precision floating-point number to be rounded.

Return Value

Type: System..::..Double
The integer nearest d. If the fractional component of d is halfway between two integers, one of which is even and the other odd, then the even number is returned. Note that this method returns a Double instead of an integral type.

This method is equivalent to calling the Round(Double, MidpointRounding) method with a mode argument of MidpointRounding.ToEven. The behavior of this method follows IEEE Standard 754, section 4. This kind of rounding is sometimes called rounding to nearest, or banker's rounding. It minimizes rounding errors that result from consistently rounding a midpoint value in a single direction.

To control the type of rounding used by the Round method, call the Math.Round(Double, MidpointRounding) overload.

If the value of d is Double..::..NaN, the method returns Double..::..NaN. If the value of d is Double..::..PositiveInfinity or Double..::..NegativeInfinity, the method returns Double..::..PositiveInfinity or Double..::..NegativeInfinity, respectively.