title: Nullable double NaN comparison in C#
body: <p>I have 2 nullable doubles, an expected value and an actual value (let's call them value and valueExpected). A percentage is found using 100 * (value / valueExpected). However, if valueExpected is zero, it returns NaN. Everything good so far.</p>
  
  <p>Now, what do I do if I need to check the value, to see if it is NaN? Normally one could use:</p>
  
  <pre><code>if (!Double.IsNaN(myDouble))
  </code></pre>
  
  <p>But this doesn't work with nullable values (IsNaN only works with non-nullable variables). I have changed my code to do the check (valueExpected == 0), but I'm still curious - is there any way to check for a nullable NaN?</p>
  
  <p><strong>Edit:</strong> When I say the code doesn't work, I mean it won't compile. Testing for null first doesn't work.</p>