 0

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

Roland K 4 years ago updated by Denis Tkachenko 4 years ago Yes, absolutely, this is very essential function. It can be called in two ways:

```>> mp.Digits(34);
>> mp('eps')
ans =
1.925929944387235853055977942584927e-34
>> mp.eps
ans =
1.925929944387235853055977942584927e-34

```

There are also similar functions (and many others):

```>> mp.realmax
ans =
1.189731495357231765085759326628007e+4932
>> mp.realmin
ans =
3.362103143112093506262677817321753e-4932

```

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,

Denis Hi Denis,

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

before the 4.3.3.12177:

`>> mp.eps(x)`

starting from 4.3.3.12177, 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 - 4.3.3.12177. Hi Pavel,