Calculating with high precision at all times

10 views (last 30 days)
Hi, i have to calculation with very small numbers (10^-15) and i would want all the digits available to show at all times to keep track and not loose precision. Even if its a 1 i would want it displayed worh all the decimal points specified. Can this be done? Cheers

Answers (2)

Image Analyst
Image Analyst on 16 Jan 2019
Yes, I believe so, if you specify enough decimal points in fprintf() when you print your results to the command window. Otherwise with format glong you only get whatever is the default but with fprintf() I've seen people display numbers with like 30 numbers to the right of the decimal point.

Walter Roberson
Walter Roberson on 16 Jan 2019
Not quite, no. The closest you can get is
format long e
This is documented as displaying 15 digits, which is one digit shorter than the number of digits that are (sometimes) resolvable by MATLAB.
On the other hand, a quick test a moment ago had it displaying 15 digits after the decimal point. Together with the digit before the decimal point that makes 16, the full discernable precision.

Community Treasure Hunt

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

Start Hunting!