The VikiD Truth

Knowledge base / Computing

Readinglist | Quick Links | Algorithms | Apple | AssemblyLanguage | BASH | C-Programmming | CommonLisp | Computer Security | CuisSmalltalk | Databases | Emacs | Exploitation | Fortran | Functional Programming | Firewalls | Git | GNUSmalltalk | Haskell | Javascript | Julia | Linux | Machine Learning | Metasploit |Machine Learning | Networking | Operating Systems |Open Data Science | Odin | Picolisp | Pharo Smalltalk | Purescript | Python | Racket | Scheme | Social Engineering | Unity | vim | V | Web Development | Windows WSL | Zig

Computing

Fortran

Here’s a truth that surprises most programmers: the oldest high-level language still in heavy use isn’t a relic – it’s quietly running the world’s weather forecasts, climate models and supercomputers. Fortran is old; modern Fortran is not.

What it is, in plain words

Fortran (“FORmula TRANslation”) was created at IBM by John Backus’s team and released in 1957 – the first widely used compiled high-level language. It was designed for one thing: turning mathematical formulas into fast machine code.

The language has been revised many times. Forget the punched-card FORTRAN 77 with its fixed columns and GOTOs. Modern Fortran means Fortran 90 and later – the current standard is Fortran 2023 – with:

Why it matters

When the job is “crunch huge arrays of floating-point numbers as fast as the hardware allows”, Fortran remains a top choice. The language forbids certain kinds of pointer aliasing that C allows, so compilers can optimise array loops aggressively. Much of the world’s scientific code – weather (ECMWF, WRF), climate (CESM), computational chemistry, physics, and the reference BLAS and LAPACK libraries that sit underneath NumPy and SciPy – is Fortran. Every time you call numpy.linalg.solve, there’s a decent chance Fortran-descended code does the work.

An everyday analogy: a specialist’s tool

A Swiss Army knife can do many things. A surgeon’s scalpel does one thing superbly. Fortran is the scalpel for numerical computing. You wouldn’t write a web server in it (you could, but why?), but for slicing through a matrix, very little is cleaner or faster.

flowchart LR
  A["Fortran (LAPACK, BLAS, solvers)"] --> B["C / C++ wrappers"]
  B --> C["NumPy / SciPy / Julia / R"]
  C --> D["Your Python notebook"]

A hands-on example

Install a compiler and the Fortran Package Manager:

sudo xbps-install -S gcc-fortran   # Void (provides gfortran)
sudo pacman -S gcc-fortran         # Arch
sudo apt install gfortran          # Debian/Ubuntu
# fpm: from conda-forge, pip (pip install fpm) or a release binary

heat.f90 – a 1D heat-diffusion simulation in modern style:

program heat
  implicit none
  integer, parameter :: dp = kind(1.0d0)
  integer, parameter :: n = 50, steps = 500
  real(dp), parameter :: alpha = 0.25_dp
  real(dp) :: u(n), unew(n)
  integer :: t

  u = 0.0_dp
  u(n/2) = 100.0_dp                      ! a hot spot in the middle

  do t = 1, steps
     ! whole-array slice arithmetic – no explicit inner loop
     unew(2:n-1) = u(2:n-1) + alpha * (u(1:n-2) - 2*u(2:n-1) + u(3:n))
     unew(1) = 0; unew(n) = 0            ! cold ends
     u = unew
  end do

  print '(a, f8.4)', 'peak temperature: ', maxval(u)
  print '(a, f8.4)', 'total heat:       ', sum(u)
end program heat
gfortran -O2 -Wall -std=f2018 heat.f90 -o heat && ./heat

The line inside the loop is the update rule

uit+1=uit+α (ui−1t−2uit+ui+1t) u_i^{t+1} = u_i^{t} + \alpha\,(u_{i-1}^{t} - 2u_i^{t} + u_{i+1}^{t})

written almost exactly as the maths reads. That’s the original promise of FORmula TRANslation, still kept.

With fpm a project is as easy as Rust’s Cargo:

fpm new myproj && cd myproj
fpm run
fpm test

Compilers in 2026

The fortran-lang.org community also maintains stdlib, a growing standard library, and the Discourse forum is very welcoming.

Common misconceptions

Connections

Last edited · 2 revisions

Tags: #Computing