Reputation: 701
I am using VS2008 c# , windows mobile 6.5, so I have to use the .Net Compact Framework, the problem is:
When Math.Round(66.05,1) the result is 66 when the correc value should be 66.1 what can I do ? how should I use the round() function
Thanks
Upvotes: -1
Views: 169
Reputation: 562
You should use the overloaded static Math.Round method which takes two arguments:
decimal x = Math.Round(2.5555, 2); // x == 2.56
You can read more here.
The issue with this is that the Mathf.Round method by default use "ToEven convention" There is an example using MidpointRounding.AwayFromZero that will give you the result you expect
Upvotes: -2