Number of digits in calculations
9 views (last 30 days)
Show older comments
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
0 Comments
Answers (2)
dpb
on 24 Apr 2015
Edited: dpb
on 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
>>
1 Comment
James Tursa
on 24 Apr 2015
The FEX submission, HPF by John D'Errico, can be found here:
John D'Errico
on 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.
0 Comments
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!