Fortran Programming Guide

Porting From Scientific Mainframes

If the application code was originally developed for 64-bit (or 60-bit) mainframes such as CRAY or CDC, you might want to compile these codes with the f77 -xtypemap option:"-xtypemap=real:64,double:128,integer:64 "

to preserve the expected precision of the original. This option automatically promotes all default REAL variables to REAL*8, default DOUBLE to REAL*16, and COMPLEX to COMPLEX*16. Only undeclared variables or variables declared as simply REAL or DOUBLE or DOUBLE PRECISION or COMPLEX are promoted; variables declared explicitly (for example, REAL*4) are not promoted.

On x86, or for better performance on SPARC, use:"-xtypemap=real:64,double:64,integer:64 "

which does not promote default DOUBLE PRECISION.

The -xtypemap option, is preferred over -dbl and -r8 and -i2. See the Fortran User's Guide and the f77(1) man pages for details.

To further recreate the original mainframe environment, it is probably preferable to stop on overflows, division by zero, and invalid operations. Compile the main program with -ftrap=common to ensure this.