title: C# equivalent to eps(X) function in matlab
body: <p>I am trying to translate some matlab code to C# and have hit a problem. Its a numerical algorithm and matlab sets a tolerance which is based on the <code>eps()</code> function. </p>
  
  <p>The matlab documentation (<a href="http://www.mathworks.co.uk/help/matlab/ref/eps.html" rel="nofollow">http://www.mathworks.co.uk/help/matlab/ref/eps.html</a>) says:</p>
  
  <p><strong>d = eps(X) is the positive distance from abs(X) to the next larger in magnitude floating point number of the same precision as X. X may be either double precision or single precision</strong></p>
  
  <p>As far as I can tell, there is no native C# function which does the same thing. I am a physicist by trade so the intricacies of floating point operations are not something I really know about. Can someone point me in the right direction?</p>
  
  <p>tl;dr: How to calculate the equivalent of eps(x) in C#? </p>