Arto's Notes re: Fortran


History

"Much of my work has come from being lazy. I didn't like writing programs, and so, when I was working on the IBM 701, writing programs for computing missile trajectories, I started work on a programming system to make it easier to write programs."


Installation

Installation on macOS

GNU Fortran is now provided as part of GCC, and can be installed with:

$ brew install gcc

$ which gfortran


Interoperability

Interoperability with C

  • Most Fortran compilers for Unix follow the original AT&T f77 compiler's calling conventions.
  • External Fortran symbols are converted to lowercase and suffixed with an underscore to avoid collisions with C symbols.

Type Mapping from Fortran to C

Fortran Type C Type
INTEGER*1, BYTE signed char
INTEGER*2 short int
INTEGER*4, INTEGER int
INTEGER*8 long long int
LOGICAL int
REAL*4, REAL float
REAL*8, DOUBLE PRECISION double
REAL*16 long double

See Also

BLAS, LAPACK, LINPACK