How to convert to double with 2 precision - string after dot?

MonsterMMORPG picture MonsterMMORPG · Feb 14, 2011 · Viewed 55.4k times · Source

I want to convert this string: 0.55000000000000004 to this double: 0.55. How to do that?

Answer

mjyazdani picture mjyazdani · Aug 12, 2012

you can use this code to reduce precision part:

double m = Math.Round(0.55000000000000004,2);

Result would be : 0.55