Number of digits in calculations

8 Ansichten (letzte 30 Tage)
Kamuran
Kamuran am 24 Apr. 2015
Beantwortet: John D'Errico am 24 Apr. 2015
I am trying to calculating the really large numbers and for me every digit is really important. And when I calculate something like
-21.5285205418215^7 = -2143380623.72146
but i can get -2.1433806237214575947621383797325809034573762312079110764454258301078078657143012124536380684836484375 × 10^9 from wolframalpha. I am not expecting this kind of precision but I would like to have more than 5 decimal. Is there a way to do that in Matlab?
Thanks

Antworten (2)

dpb
dpb am 24 Apr. 2015
Bearbeitet: dpb am 24 Apr. 2015
Symbolic Toolbox is the TMW solution; there are some extended precision support packages on the File Exchange I believe.
The five digits displayed at the command line is simply a figment of the display(*); TMW uses IEEE double by default which has 15-16 decimal digits of precision. If you really need more than that, one of the above is the alternative.
(*)
>> pi
ans =
3.1416
>> format long
>> pi
ans =
3.141592653589793
>>

John D'Errico
John D'Errico am 24 Apr. 2015
As much as I agree that you can use the symbolic toolbox, or even my own HPF, the fact is, most of those digits in the result you show are worthless crapola.
You started out with 15 significant digits. Thinking that you can raise that number to a large power, and get 100 plus digits out the end is simple foolishness.
Unless you are working with integers, any digits past 15 digits in the result are virtually meaningless.

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by