Est. 1957 Intermediate

Fortran

The first high-level programming language, designed for scientific and engineering computation. Still actively used in high-performance computing.

Created by John Backus at IBM

Paradigm Imperative, Procedural, Structured, Object-Oriented (Fortran 2003+)
Typing Static, Strong
First Appeared 1957
Latest Version Fortran 2023

Fortran (FORmula TRANslation) holds a unique place in computing history as the first widely adopted high-level programming language. Created when programs were still punched onto cards, Fortran proved that computers could efficiently execute code written in something resembling human mathematical notation rather than machine instructions.

History & Origins

In 1953, John Backus at IBM proposed developing a programming system that would allow scientists and engineers to write programs using familiar mathematical formulas. The skeptics were many - conventional wisdom held that no automatic coding system could produce machine code as efficient as hand-written assembly.

Backus and his team proved them wrong. When FORTRAN I shipped in 1957, its compiler produced code that often matched hand-optimized assembly in performance. This achievement was revolutionary: suddenly, programming was accessible to scientists and engineers who didn’t need to understand the intricate details of computer architecture.

The Name That Stuck

The original all-caps “FORTRAN” reflected the era’s convention of uppercase-only computer systems. Modern standards use “Fortran” with initial capitalization, though you’ll see both in practice. The name perfectly captures its purpose: translating mathematical formulas into executable code.

Why Fortran Still Matters

Despite being nearly 70 years old, Fortran remains essential in specific domains:

1. Unmatched Numerical Performance

Fortran compilers have been optimized for numerical computation longer than any other language. Features like:

  • Array operations as first-class language features
  • Column-major storage matching mathematical conventions
  • Strict aliasing rules enabling aggressive optimization

2. Massive Legacy Codebases

Billions of lines of Fortran code power:

  • Weather forecasting systems
  • Climate models
  • Computational chemistry packages
  • Aerospace simulations
  • Nuclear reactor calculations

Rewriting this code in another language would cost billions and introduce subtle bugs in safety-critical systems.

3. Modern Language Features

Fortran 2018/2023 is not your grandfather’s FORTRAN:

  • Object-oriented programming
  • Coarrays for parallel computing
  • Interoperability with C
  • Modern module system
  • Generic programming (parameterized derived types)

The Two Fortrans

When working with Fortran, you’ll encounter two distinct styles:

Fixed-Form (Classic FORTRAN 77 Style)

1
2
3
      PROGRAM HELLO
      WRITE(*,*) 'Hello, World!'
      END PROGRAM HELLO
  • Columns 1-6: Labels and continuation
  • Column 7: Continuation character
  • Columns 7-72: Code
  • Columns 73-80: Ignored (originally for card sequence numbers)

Free-Form (Modern Fortran 90+ Style)

1
2
3
program hello
    print *, "Hello, World!"
end program hello
  • No column restrictions
  • Comments with !
  • Lowercase conventions
  • Modern syntax

All modern Fortran code uses free-form, but you’ll encounter fixed-form in legacy codebases.

Modern Fortran Compilers

Several high-quality compilers exist:

CompilerVendorPlatformsNotes
gfortranGNU/GCCAllFree, excellent F2018 support
ifort/ifxIntelLinux, Windows, macOSCommercial, best optimization for Intel CPUs
nvfortranNVIDIALinuxGPU acceleration via OpenACC
flangLLVMLinuxNew LLVM-based compiler
nagforNAGAllCommercial, best standards compliance

For this tutorial series, we’ll use gfortran via the official GCC Docker image.

Getting Started

Fortran code is stored in files with extensions:

  • .f90, .f95, .f03, .f08 - Free-form source (use .f90 by convention)
  • .f, .for, .f77 - Fixed-form source

The typical workflow:

1
2
3
4
5
# Compile
gfortran -o program program.f90

# Run
./program

Continue to the Hello World tutorial to write your first Fortran program.

Timeline

1954
John Backus proposes 'The IBM Mathematical Formula Translating System'
1957
FORTRAN I released - the first high-level programming language
1958
FORTRAN II adds subroutines and functions
1962
FORTRAN IV becomes widely adopted
1966
FORTRAN 66 - first industry-standard version (ANSI)
1978
FORTRAN 77 adds structured programming features
1991
Fortran 90 modernizes the language (free-form, modules, arrays)
1997
Fortran 95 refines Fortran 90 features
2004
Fortran 2003 adds object-oriented programming
2010
Fortran 2008 adds coarrays for parallel programming
2018
Fortran 2018 enhances parallelism and C interoperability
2023
Fortran 2023 standard approved

Notable Uses & Legacy

Weather Forecasting

Global weather prediction models like GFS and ECMWF run on millions of lines of Fortran code, processing petabytes of atmospheric data.

Computational Fluid Dynamics

NASA and aerospace companies use Fortran for airflow simulations that design aircraft, rockets, and spacecraft.

Nuclear Physics

Particle physics simulations at CERN and nuclear research facilities rely on decades of optimized Fortran libraries.

Climate Modeling

Climate change predictions from NOAA and IPCC use Fortran-based models that have been refined over 40+ years.

Financial Modeling

High-frequency trading systems and risk analysis tools use Fortran for its raw computational speed.

Language Influence

Influenced By

Speedcoding Mathematical notation

Influenced

ALGOL BASIC C PL/I COBOL Nearly all subsequent programming languages

Running Today

Run examples using the official Docker image:

docker pull gcc:latest

Example usage:

docker run --rm -v $(pwd):/app -w /app gcc:latest sh -c 'gfortran -o hello hello.f90 && ./hello'

Topics Covered

Last updated: