How to increase the precision of Matlab (compared to Fortran) ???
7 views (last 30 days)
I am using Matlab to translate subroutines coded by FORTRAN. However I found that the truncation error of matlab is very important, it means the precision of matlab can not be comprared to Frotran.
I tried format command, it does not work. Anyone knows how to increase the precision of matlab?
Walter Roberson on 18 Nov 2012
MATLAB's "double" has the same precision as Fortran's REAL*8.
MATLAB does not have a numeric class equivalent to REAL*16.
Ben Barrowes on 18 Nov 2012
What do you mean when you say "compare"? "format long" in matlab should give many digits of display. In any case, like Strider says, matlab default double is the same precision as fortran's real*8. If you need arbitrary precision in matlab (but slow calculation) try the multiple precision toolbox:
If you are converting fortran to matlab, try f2matlab:
it can get you 95% of the way to working m-code.