title: Is this a valid float comparison that accounts for a set number of decimal places?
body: <p>I'm writing an extension method to compare two floats using a set number of decimal points (significant figures) to determine if they are equal instead of a tolerance or percentage difference.  Looking through the other questions regarding float comparison I see complex implementations.  Have I oversimplified or is this valid?</p>
  
  <pre><code>/// &lt;summary&gt;
  /// Determines if the float value is equal to (==) the float parameter according to the defined precision.
  /// &lt;/summary&gt;
  /// &lt;param name="float1"&gt;The float1.&lt;/param&gt;
  /// &lt;param name="float2"&gt;The float2.&lt;/param&gt;
  /// &lt;param name="precision"&gt;The precision.  The number of digits after the decimal that will be considered when comparing.&lt;/param&gt;
  /// &lt;returns&gt;&lt;/returns&gt;
  public static bool AlmostEquals(this float float1, float float2, int precision = 2)
  {
      return (Math.Round(float1 - float2, precision) == 0);
  }
  </code></pre>
  
  <p><strong>Note:</strong> I'm looking for a comparison on decimal places, not tolerance.  I don't want 1,000,000 to equal 1,000,001.</p>