38
Possible Duplicate:
c# - How do I round a decimal value to 2 decimal places (for output on a page)
I want to truncate the decimals like below
i.e.
- 2.22939393 -> 2.229
- 2.22977777 -> 2.229
Possible Duplicate:
c# - How do I round a decimal value to 2 decimal places (for output on a page)
I want to truncate the decimals like below
i.e.
Maybe another quick solution could be:
>>> float("%.1f" % 1.00001)
1.0
>>> float("%.3f" % 1.23001)
1.23
>>> float("%.5f" % 1.23001)
1.23001