legacy code with real*16
Richard E Maine
Richard.Maine@nasa.gov
Tue Nov 29 00:10:00 GMT 2005
On Nov 28, 2005, at 1:52 PM, James Mitchell Allmond wrote:
> I'd appreciate any help. I'm compiling some old legacy code that makes
> use of real*16 variables in computations....
> I want to have this legacy code compatible with standard compilers, is
> there an alternative to real*16 I can use?
In f77 and earlier, there is no standard-conforming way to do this. In
f90, the standard-conforming solution is to use the selected_real_kind
intrinsic to define an appropriate KIND parameter. That's exactly what
selected_real_kind is about. See any f90 text for details. Of course,
by using an f90 feature, you would lose compatibility with old f77
compilers. You have to choose between standard and portable to f77.
SInce f77 didn't have a standard solution, you can't have both.
And even with f90, the standard doesn't require that compilers have an
appropriate precision. The standard just defines how the user asks for
it. If the compiler doesn't support that precision, then nothing in the
code is going to help (short of defining an extended precision
user-defined type, which is a major undertaking and likely would have
very poor performance).
--
Richard Maine | Good judgment comes from experience;
Richard.Maine@nasa.gov | experience comes from bad judgment.
| -- Mark Twain
More information about the Fortran
mailing list