Make double-precision default in g77, Fortran compiler

A. Rex picture A. Rex · Jan 24, 2009 · Viewed 8k times · Source

Is there an analog of the "-fdefault-real-8" gfortran (the GNU Fortran 95 compiler) option in g77 (the GNU Fortran 77 compiler)? This option sets the default real type to an 8-byte wide type.

I currently have code where single-precision arithmetic is limiting my accuracy, and so I need double-precision. (It's not just intermediate values that I want to be in double-precision, which is an FPU flag; I want everything to be in double-precision.) I know that I have some other approaches (using gfortran, using other compilers, or changing all REALs to DOUBLE PRECISIONs), but they're not ideal for my situation.

So, is there any way to set the default real type to be double precision, namely 8 bytes wide, in g77?

Answer

Scottie T picture Scottie T · Jan 24, 2009

If you can't find a flag in the man pages, you might try a #define macro.

#define REAL DOUBLE PRECISION