Possible Duplicate:
Create Excel (.XLS and .XLSX) file from C#
Rounding double values in C#
my double function generating values like this
56,365989365
i want just value like this 56,36
how to get this ?
Possible Duplicate:
Create Excel (.XLS and .XLSX) file from C#
Rounding double values in C#
my double function generating values like this
56,365989365
i want just value like this 56,36
how to get this ?
If you want to trucate the value:
value *= 100;
value = Math.Truncate(value);
value /= 100;
If you want to round the value:
value = Math.round(value, 2);
Use Math.Round
. The second argument is the number of places.
var x = Math.Round(56.365989365, 2);