Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB's accuracy of digits number

Asked by Dias Papas on 22 Jun 2011
Latest activity Commented on by Alexei on 26 Nov 2014

Hi to everyone,

I am dealing with satellite data with accurancy of 25 digits. As I know MATLAB provides computations with maximum 16 digits (long e format). Is there any way to process these data with 25 digits accuracy, because i dont want these values to be rounded?

Thanks a lot



Jan Simon on 22 Jun 2011

Satellite data with an accuracy of 25 digits? You need such an accuracy to determine the earth-sun distance with less than a radius of a neutron.
I'm very interested in the scientific application of such an accuracy.

Matt Fig on 22 Jun 2011

Dias, I too doubt the actual accuracy of that many digits. There is a difference between having 25 digits and having 25 useful digits.

MATLAB always uses doubles unless you specify another data type. The display (format long g) has nothing to do with the internal storage. The number is the same no matter how it is displayed in the command window...

the cyclist on 22 Jun 2011

It could be that the each number being sent encode information on more than one variable, with some kind of multiplexing. So, maybe the final digits are not just more precision on the first digits.

Dias Papas


No products are associated with this question.

5 Answers

Answer by the cyclist on 22 Jun 2011
Accepted answer

Do you have the Symbolic Math Toolbox? If so, then:


Fangjun Jiang on 22 Jun 2011

So, can the Symbolic Math Toolbox be used to read in a long precision data?

Walter Roberson on 22 Jun 2011

If my memory hasn't slipped a bit: the Maple version of the Symbolic Math Toolbox did not have any file input operations; those were, though, exposed by the Extended Symbolic Math Toolbox.

The MuPad version of the Symbolic Math Toolbox does have file input operations: see

I do not see there any equivalent of fscanf(). On the other hand, when numbers with large numbers of digits are input, those digits are all preserved... though of course if you then do an arithmetic operation on such a number, the result might be in terms of the current Digits setting.

the cyclist
Answer by Paulo Silva on 22 Jun 2011

The Symbolic Math Toolbox™ can handle the 25 digits, some of their functions have default digit number of 32 digits.


Fangjun Jiang on 22 Jun 2011

Help me out here, Paulo! When I type digits in my MATLAB command window, it shows 32. But my example below shows otherwise. Any explaination?

Sean de Wolski on 22 Jun 2011


might interest you.

Paulo Silva
Answer by Fangjun Jiang on 22 Jun 2011

This is a really good question. I like it. Look at the following code:

aTF =
     1     0     0     0     0
     0     1     0     0     0
     0     0     1     1     1
     0     0     1     1     1
     0     0     1     1     1
bTF =
     1     0     0     0     0
     0     1     0     0     0
     0     0     1     0     0
     0     0     0     1     1
     0     0     0     1     1


1. What is the number of precision that MATLAB double can distinguish, 16, 17 or 18? The first example above shows 17, the second shows 18.

2. What to do if need to read more number of precision.


Sean de Wolski on 22 Jun 2011

I personally find it hard to imagine any measurement system that has an SNR high enough to require anything more than floating point precision.

You need 39 digits of pi to measure the observable universe to within the radius of a hydrogen atom.

Malcolm Lidierth on 25 Jun 2011

For double precision see

For more digits, you could use java.math.BigDecimal and/or the Apache math BigReals that use them e.g. in MATLAB

Fangjun Jiang
Answer by Dias Papas on 25 Jun 2011

Thanks a lot for your answers. My field, which i use such a number of digits, is satellite orbit determination and gravity field modeling. For example ocean's tide's data are given with 25 digits. Yes, this doesnt mean that all of them are totally useful but they are play their role.

Anyway thanks everyone!



Jan Simon on 25 Jun 2011

This is really strange. Heisenberg's uncertainty principle means, that such an adequate position measurement will yield to an enormous impulse. Even a small and light object as the ocean would explode by trying to measure the position with such an accuracy. Of course there can be a reason for such an accuracy, but at least it cannot be physically motivated.

Alexei on 26 Nov 2014

Pretty sure that's not what it means. I'm pretty sure the uncertainty principle means that such an adequate position measurement will yield enormous uncertainty in what the impulse is. The impulse could still be really tiny or zero -- but you would have no idea.

Dias Papas
Answer by Derek O'Connor on 25 Jun 2011

Here is a quotation from Prof Nick Trefethen FRS, Oxford:

11. No physical constants are known to more than around eleven digits, and no truly scientific problem requires computation with much more precision than this.

I'll repeat the question asked by others here: why do you need (or think you need) 25 decimal digits.

Here is a cognate quotation from Trefethen:

6. If the answer is highly sensitive to perturbations, you have probably asked the wrong question.

These quotations (maxims) can be found at:

This Matlab Newsgroup thread may be useful:


Jan Simon on 26 Jun 2011

I see a contradiction between the two statements: Imagine that you want to find out, if an answer is highly sensitive to perturbations of a value, which is known to 11 digits. Therefore you need _some_ more digits, such that the 64bit doubles are a a quite fine choice.

Derek O'Connor on 28 Jun 2011


I don't understand why you need more digits. Why not change the last digit of the 11-digit value and see if there is a large change in the answer?

I do not see a contradiction between Maxim 6 and Maxim 11. They are essentially "orthogonal", i.e., independent. Of course, if a problem is ill-conditioned then many digits may be needed to get an exact answer, which seems to contradict maxim 11. But Maxim 6 says that you should not be solving ill-conditioned problems (except as a hobby, maybe).

See the thread in my answer above and pages 8 to 11 in

Derek O'Connor

Contact us