This documentation is archived and is not being maintained.

Math.Round Method (Decimal)

.NET Framework 1.1

Returns the whole number nearest the specified value.

[Visual Basic]
Overloads Public Shared Function Round( _
   ByVal d As Decimal _
) As Decimal
public static decimal Round(
 decimal d
public: static Decimal Round(
 Decimal d
public static function Round(
   d : Decimal
) : Decimal;


A Decimal number to be rounded.

Return Value

The whole number nearest parameter d. If d is halfway between two whole numbers, one of which by definition is even and the other odd, then the even number is returned.


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.


The following code example demonstrates rounding to nearest.

[Visual Basic] 
Math.Round(4.4) 'Returns 4.0.
Math.Round(4.5) 'Returns 4.0.
Math.Round(4.6) 'Returns 5.0.

Math.Round(4.4); //Returns 4.0.
Math.Round(4.5); //Returns 4.0.
Math.Round(4.6); //Returns 5.0.


Math::Round(4.4); //Returns 4.0.
Math::Round(4.5); //Returns 4.0.
Math::Round(4.6); //Returns 5.0.

System.Math.Round(4.4) //Returns 4.0.
System.Math.Round(4.5) //Returns 4.0.
System.Math.Round(4.6) //Returns 5.0.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Math Class | Math Members | System Namespace | Math.Round Overload List | Ceiling | Floor