title: What are the differences between floating point Equals and the Equality operator (==) in C#?
body: <p>In C#, <a href="https://docs.microsoft.com/en-us/dotnet/api/system.single.equals?view=net-5.0" rel="nofollow noreferrer"><code>Single.Equals</code></a></p>
  <blockquote>
  <p>Returns a value indicating whether two instances of Single represent the same <em>value</em>.</p>
  </blockquote>
  <p>While Single's <a href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/equality-operators" rel="nofollow noreferrer"><code>Equality operator</code></a> (<code>==</code>)</p>
  <blockquote>
  <p>The equality operator == returns true if its operands <em>are equal</em>, false otherwise.</p>
  </blockquote>
  <p>(emphasis mine).</p>
  <p>One notable difference between these comparison methods involves NaN:</p>
  <pre><code>float.NaN.Equals(float.NaN) =&gt; true
  float.NaN == float.NaN =&gt; false
  </code></pre>
  <p>I understand why <code>operator==</code> is false between NaNs (answer <a href="https://stackoverflow.com/questions/1565164/what-is-the-rationale-for-all-comparisons-returning-false-for-ieee754-nan-values">here</a>), but why is <code>Equals</code> different? Are there other values for which <code>Equals</code> provides a different result than <code>operator==</code>?</p>