NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Math.Round

Rounds a number to the nearest whole number, as specified by Section 5.5 of the IEEE 754 standard.

[Visual Basic]
Public Shared Function Round( _
   ByVal a As Double _
) As Double
[C#]
public static double Round(
   double a
);
[C++]
public: static double Round(
   double a
);
[JScript]
public static function Round(
   a : double
) : double;

Parameters

a
A number to be rounded.

Return Value

Returns the nearest whole number. If a is exactly halfway between two whole numbers, this method returns the even whole number.

Remarks

According to IEEE 754, the default rounding direction is round towards nearest. This means that when the mathematical result of an operation lies halfway between two representable numbers, the one nearest to the mathematical result is delivered as the result. If the mathematical result lies halfway between the two representable numbers, then round to nearest mode specifies round to the nearest even number (final bit is zero.)

Example

Math.Rint (0.5) returns (double) 0.
Math.Rint (1.67) returns (double) 2.
Math.Rint (5.34) returns (double) 5.

See Also

Math Class | Math Members | System Namespace