title: Comparing two decimals
body: <p>I want to compare two decimals in c# with some margin of error. Can anyone point out problem with the following code. Note that I am interested in 6 decimal places after that I could ignore the values. </p>
  
  <pre><code>var valOne = decimal.Round(valueOne, 6);
  var valTwo = decimal.Round(valueTwo, 6);
  var difference = Math.Abs(valOne - valTwo);
  if (difference &gt; 0.0000001m) {
     Console.WriteLine("Values are different");
  }
  else {
      Console.WriteLine("Values are equal");
  }
  </code></pre>
  
  <p>or is there a better way.</p>