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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Of course, this won’t work if you’re trying to truncate rounding error, but it should work fine with the values you give in your examples. See the first two answers to this question for details on why it won’t work sometimes.