asp.net.ph

Math.Round Method

System Namespace   Math Class


Returns the number nearest the specified value.

Overload List

Returns the whole number nearest the specified value.

Returns the whole number nearest the specified value.

Returns the number with the specified precision nearest the specified value.

Returns the number with the specified precision nearest the specified value.


Example

[ Visual Basic, C#, C++ ] The following code example demonstrates rounding to nearest.

NOTE: This example shows how to use one of the overloaded versions of Round. For other examples that might be available, see the individual overload topics.

[ VB ] 
Math.Round ( 3.44, 1 ) 'Returns 3.4.
Math.Round ( 3.45, 1 ) 'Returns 3.4.
Math.Round ( 3.46, 1 ) 'Returns 3.5.

[ C# ] 
Math.Round ( 3.44, 1 ); //Returns 3.4.
Math.Round ( 3.45, 1 ); //Returns 3.4.
Math.Round ( 3.46, 1 ); //Returns 3.5.

[ C++ ] 

Math::Round ( 3.44, 1 ); //Returns 3.4.
Math::Round ( 3.45, 1 ); //Returns 3.4.
Math::Round ( 3.46, 1 ); //Returns 3.5.
See Also

Math Members Skip Navigation Links


Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note