Hyde County, South Dakota is the Pin Tail Duck Capital of the world. Visit scenic Highmore, SD in 2007!
Richard Harter's World
Site map
Mathcomp
April 2007
email

Perceived merits of Fortran

In the comp.lang.fortran news group I posed the following question:

"Fortran is widely perceived as being a superior language for numeric and scientific programming. What are the features and aspects that make it so?"

There was quite a bit of discussion and many interesting points were made. Below I have collated responses together and have added further commentary, some of which may be on point. I thought the comments and points being made would be of interest.

Many thanks to all, and to Beliavsky, Brooks Moses, Michael Prager, Charles Russell, and David Rowell in particular.

Perceived advantages related to Scientific programming

  • Efficiency:
    Fortran is widely perceived as being particularly efficient for computationally intense scientific programs. (Proponents of other languages often contest this claim.) In part the reason is that a great deal of work has been done on optimization by compilers, and in part the reason is that Fortran has a number of features, e.g., no aliasing by fiat, that enable a variety of optimizations.
  • Legacy Code
    There is a large body of legacy code, both applications and libraries, mostly scientific and numerical analysis. There are (or are felt to be) more resources for developing numerical analysis in fortran than in other languages.
  • Intrinsics:
    Fortran has a suite of intrinsic mathematical functions and numerical modes. Thus complex arithmetic is built in and supported, exponentiation is a language operator, there are generic intrinsics for single and double precision, and the trigonometric, exponential, and logarthmic functions are intrinsics. For a number of reasons intrinsics are more desirable than "standard" libraries - for the developer.
  • Multi-dimensional arrays:
    Multi-dimensional (MD) arrays are hard to do right in a language. Many languages either do not provide them or else provide seriously inadequate support. Some issues are that MD arrays should be first class citizens, i.e., the information (bounds and extents) about them goes with them. Bounds should be relativizable, and subspace extents should be naturally accessible. Usw.

Language features perceived to make programming more pleasant:

  • Safe DO loops: The loop variable is prohibited from being altered within the loop.
  • Arrays lower bounds: Array lower bounds are 1 by default. This is not entirely a matter of religious conviction; 0 based indexing implies storage offset orientation, and 1 based indexing implies ordinal based orientation. More importantly arrays bounds can be set as desired.
  • End of line statement termination: Fortran uses end of line statement termination. Studies were cited that showed that end of line termination is less error prone than semicolon termination/separation.
  • Enclosing block statements: Fortran uses enclosing blocks rather than blocks internal to statements. This has minor advantages.
  • Restricted pointers: Fortran's pointer handling requires that pointer targets be declared as TARGET. This is safer than wide open pointers and facilitates optimization.
  • Bounds checking: Array bounds check is normally available as a simple compiler option.
  • Derived types: The KIND mechanism (Fortran 90) and parameterized derived types (Fortan 2003) solve problems with platform dependent accuracy.
  • Subroutines and functions: Fortran (like many languages) has both subroutines and functions.


This page was last updated April 1, 2007.

Richard Harter's World
Site map
Mathcomp
April 2007
email
Hyde County, South Dakota is the Pin Tail Duck Capital of the world. Visit scenic Highmore, SD in 2007!