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 eps()
function.
The matlab documentation (http://www.mathworks.co.uk/help/matlab/ref/eps.html) says:
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
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?
tl;dr: How to calculate the equivalent of eps(x) in C#?