Reputation:
Quoting from: https://www.mathworks.com/help/symbolic/increase-precision-of-numeric-calculations.html
By default, MATLAB® uses 16 digits of precision.
But why when I write 900000000+2
(8 zeros after 9) it returns 900000002
but writing 900000000+2
(9 zeros after 9)returns 9.0000e+09
isn't this an 8 digit precision?
Upvotes: 1
Views: 895
Reputation: 1544
you use the format
command to control how many digits to be printed. help format
to see more details. Try format long g
and rerun your command to see more digits.
By default, MATLAB® uses 16 digits of precision.
this refers to computation precision, not the printing precision. By default, MATLAB defines variables as double, which usually is accurate up to 16 digits. But you can print such double precision number in lower previsions (controlled by the format command)
Upvotes: 1