I believe you don't really need to round any numeric values. This is rarely needed, very rarely. Who wants to loose precision in calculations? Most likely, you only want to present a number in a form of string, to show the value on screen or somewhere else.
This is called "formatting". Even though such operation is internally also based on rounding, you never round any numeric values in your code, so you avoid a risk of
accidental loss of accuracy. And to format the numerical values to string, you just need to use one of its
ToString
methods with parameters setting format, precision, culture and/or other formatting detail. For example, for
double
, please see:
http://msdn.microsoft.com/en-us/library/system.double.tostring.aspx[
^],
http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx[
^],
http://msdn.microsoft.com/en-us/library/0c899ak8.aspx[
^].
—SA