(Redirected from FORTRAN
Fortran (also FORTRAN) is a statically typed, compiled, programming language originally developed in the 1950s and still heavily used for scientific computing and numerical computation half a century later. The name is a portmanteau of Formula Translator/Translation. Early versions of the language were known as FORTRAN, but the capitalization has been dropped in newer revisions beginning with Fortran 90. The official language standards now refer to the language as "Fortran".
Although originally a procedural language, recent versions of Fortran have included some features to support object-oriented programming.
History, versions, and revisions
The first FORTRAN compiler was developed for the IBM 704 in 1954–57 by an IBM team led by John W. Backus. This was an optimizing compiler, because the authors reasoned that no one would use the language if its performance were not comparable to assembly language.
The language was widely adopted by scientists for writing numerically intensive programs, which encouraged compiler writers to produce compilers that generate faster code. The inclusion of a complex number data type in the language made Fortran especially suited to scientific computation. There are many vendors of high performance Fortran compilers today. Many advances in the theory and design of compilers were motivated by the need to generate good code for Fortran programs.
Several standards of the language have appeared: FORTRAN II in 1958, FORTRAN IV in 1961, FORTRAN 66 in 1966, FORTRAN 77 in 1977 , Fortran 90 in 1990, Fortran 95 in 1995, and Fortran 2003 in 2003. Fortran 90 was a major revision, adding free source form, dynamic memory allocation, array operations, abstract data types, operator overloading, pointers, and modules to group related procedures and data together. Fortran 95 was a minor revision, adding features for parallel programming from the High Performance Fortran dialect, such as user-defined pure and elemental functions, and the forall construct. The most recent formal standard for the language, published in 2004, is known as Fortran 2003. It is an upwardly-compatible extension of Fortran 95, adding, among other things, support for IEEE floating-point arithmetic, exception handling, object-oriented programming, and improved interoperability with the C language. A comprehensive summary of the 2003 additions is at the ISO Fortran Working Group (WG5) web site, ftp://ftp.nag.co.uk/sc22wg5/N1551-N1600/N1579.pdf.
Features and extensions
Initially, the language relied on precise formatting of the source code and heavy use of statement numbers and goto statements. These quirks have been removed from newer versions of the language. Successive versions also introduced 'modern' programming concepts, such as source code comments and output of text, IF-THEN-ELSE (in FORTRAN 77), recursion (in Fortran 90), and parallel constructs, while still attempting to maintain Fortran's 'lean' profile and high performance. Among the most popular specialized Fortran-based languages were SAS, for generating statistical reports, and SIMSCRIPT, for simulating processes involving queuing. F is a clean subset of Fortran 95 that removes the unstructured features of Fortran, such as EQUIVALENCE.
Vendors of high performance scientific computers (Burroughs, CDC, Cray, Honeywell, IBM, Texas Instruments, Univac...) added extensions to Fortran to make use of special hardware features such as: instruction cache, CPU pipeline , vector arrays, etc. For example, one of IBM's Fortran compilers (H Extended IUP) had a level of optimization which reordered the machine code instructions to keep several internal arithmetic units busy at the same time. Another example is CFD, a special 'version' of Fortran designed specifically for the ILLIAC IV supercomputer, running at NASA's Ames Research Center. These extensions have either disappeared over time or had elements incorporated into the main standard; the major remaining extension is OpenMP, which is a cross-platform extension for shared memory programming. One new extension, CoArray Fortran, is intended to promote parallel programming.
Syntax drawbacks and advantages
As what was basically a first attempt at designing a high-level language, the language's syntax is regarded as arcane by many programmers who learned more modern languages. It is difficult to write a lexical analyser for, and one-character mistakes can lead to runtime errors rather than compilation errors if more recent constructs such as free-form source are not used. Some of the earlier versions, particularly, lacked facilities that would be regarded as useful in modern machines, such as dynamic memory allocation.
One should, however, consider that the features of Fortran have been tuned to scientific and numerical work, and that many of its deficiencies have been addressed in more recent versions. For example, Fortran 95 has very short commands for performing mathematical operations on arrays which not only greatly improve program readability but also provide useful information to the compiler to enable it to vectorize operations. For these reasons, Fortran is not often used outside scientific and engineering numerical work, but remains the language of choice for high performance numerical computing.
This program, which calculates the area of a cylinder, can be compiled and run with any Fortran 90 or 95 compiler. The text after the initial "!" on a line is a comment.
! Calculate the area of a cylinder.
! Declare variables and constants.
implicit none ! Require all variables to be declared -- Fortran 90 feature.
integer :: ierr
real :: radius,height,area
real , parameter :: pi = 3.14159
! Prompt the user for radius and height and read them.
write (*,*) "Enter radius and height, 'q' to end."
read (*,*,iostat=ierr) radius,height
! If radius and height could not be read from input, terminate program.
if (ierr /= 0) stop "ending program"
! Compute area. The ** means "raise to a power".
area = 2*pi*(radius**2 + radius*height)
! Write the input variables (radius, height) and output (area) to the screen.
write (*,"(1x,'radius=',f6.2,5x,'height=',f6.2,5x,'area=',f6.2)") radius,height,area
end program cylinder
A retro example of a Fortran IV (as it was called in 1968) program deck is available on the IBM 1130 page including the IBM 1130 DM2 JCL required for compilation and execution.
- Adams, Jeanne; Brainerd, Walter; Martin, Jeanne; Smith, Brian; Wagener, Jerrold (1997). Fortran 95 Handbook: Complete ISO/ANSI Reference. MIT Press.
- Metcalf, Michael; Reid, John; Cohen, Malcolm (2004). Fortran 95/2003 Explained. Oxford University Press.
- Nyhoff, Larry; Leestma, Sanford (1995). FORTRAN 77 for Engineers and Scientists with an Introduction to FORTRAN 90. 4th Edition. Prentice Hall. ISBN 013363003X.
- ANSI X3.198-1992 (R1997). Title: Programming Language "Fortran" Extended. Informally known as Fortran 90. Published by ANSI.
- ISO/IEC 1539-1:1997. Title: Information technology - Programming languages - Fortran - Part 1: Base language. Informally known as Fortran 95. There are a further two parts to this standard. Part 1 has been formally adopted by ANSI.
- ISO/IEC 1539-1:2004. Title: Information technology -- Programming languages -- Fortran -- Part 1: Base language. Informally known as Fortran 2003.
Free software compilers
Last updated: 10-29-2005 02:13:46