MATLAB: Fortran 128 bit precision

type castvariables

I have code that I want to port from fortran into Matlab hopefully. Does the new 2012a Matlab, 64Bit, have a true "REAL*16" long double type cast?
If so, how do you type cast a variable to be a specific size? e.g; REAL*8 or Real*16 for 64bit and 128bit respectively. I have a stiff differential solver program written for the CRAY and its convergence criteria requires this precision. Without re-writing for Windows 7, Fortran and hoping, I thought MATLAB 64 would be a good platform due to the high number of matrices written.
Thanks ahead of time, Bill

Best Answer

To convert your code to matlab, f2matlab will help. It will do about 90% or more of the work for you. http://www.mathworks.com/matlabcentral/fileexchange/5260
Once you are in matlab, you can use the higher precision solutions above. In terms of more alternatives, you could use the multiple precision toolbox: http://www.mathworks.com/matlabcentral/fileexchange/6446 but that will be slow compared to even matlab code.
or the Mathematica interface if you happen to have mathematica: http://www.mathworks.com/matlabcentral/fileexchange/6044
If you need speed and real*16, just leave it in fortran if that works for you. It should be able to compile on a windows platform. You say you tried for 3 months, so it seems like there is some problem, but it should work and we or others in fortran forums should be able to help. Otherwise a mex interface is a good idea to preserve speed but add a matlab interface. In the mex case, your numbers will be converted down to doubles when they return to matlab.
bb