Is there a mp-version of Matlab's function 'eps' ?

Roland K 4 years ago updated by Denis Tkachenko 4 years ago 4

Yes, absolutely, this is very essential function. It can be called in two ways:

>> mp.Digits(34);
>> mp('eps')
ans = 
>> mp.eps
ans = 

There are also similar functions (and many others):

>> mp.realmax
ans = 
>> mp.realmin
ans = 

Please take a look to the last section on the page: http://www.advanpix.com/documentation/function-reference/

Hi Pavel,

Sorry for a potentially dumb question.

Regarding the eps() function in Matlab, it is sometimes useful to return the positive distance from abs(x) to the next largest number of the same precision as x. This is used, for example, in setting the adaptive tolerance level for determining matrix rank. Matlab's algorithm for default tolerance level in double precision is:

s = svd(A);

tol = max(size(A))*eps(max(s));

r = sum(s > tol);

I would like to check what happens to rank of a matrix of interest using this algorithm in arbitrary precision. However, I cannot think of a way to get the analogue of eps(max(s)) above (how to get eps(x) is the problem).

What would be the way to compute it using the toolbox?

Thank you,


Hi Denis,

To get machine epsilon for particular number 'x' please use:

before the

>> mp.eps(x)

starting from, the prefix 'mp.' is no longer needed:

>> eps(x)

The 'rank(A,tol)' has been included in recent versions of toolbox as well.

I highly suggest you to use the newest version of toolbox -

Hi Pavel,

Thank you for your very prompt reply, that solves my question!