Compare double till precision 2

Posted by Ram on Stack Overflow See other posts from Stack Overflow or by Ram
Published on 2010-04-21T14:43:37Z Indexed on 2010/04/28 13:23 UTC
Read the original article Hit count: 383

Filed under:

Hi,

I want to compare two double values till the second digit from decimal point. I am using following statement but I think it is not working properly.

dbl1.ToString("g2", CultureInfo.InvariantCulture).Equals( dbl2.ToString("g2", CultureInfo.InvariantCulture))

Am I missing anything here?

© Stack Overflow or respective owner

Related posts about .NET