다음을 통해 공유


Math.Round Method

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

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

Syntax

[MethodImplAttribute(InternalCall)]
public static double Round (
         doublea
)

Parameters

  • a
    A double-precision floating-point number to be rounded.

Return Value

The integer nearest a. If the fractional component of a is halfway between two integers, one of which is even and the other odd, then the even number is returned.

Remarks

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.

Version Information

Available in the .NET Micro Framework versions 3.0, 3.5, 4.0, and 4.1.

See Also

Reference

Math Class
Math Members
System Namespace