3 Facts About Fortran
- The name Fortran derives from the name Formula Translation.
- Initially, the spelling of the name was in all-uppercase form as FORTRAN before changing to Fortran.
- Fortran was the first high-level computer programming language for wide use.
What is Fortran: Explained
Fortran refers to a general-purpose computer programming language ideal for scientific computing and numeric computation. Since its inception in the 1950s, Fortran has dominated the computationally intensive areas. These computational areas include finite element analysis, computational chemistry, geophysics, numerical weather predictions, crystallography, computational physics, and computational fluid dynamics.
Fortran continues to stand out as a high-performance computing language. For that reason, most world’s fastest supercomputers have adopted its use for their programs. The programming language has had several versions since its inception. Each Fortran version has added extensions but retains compatibility with the previous versions. With each successive version, there has been added support for character-based data processing, structured programming, array programming, generic programming, to mention but a few.
Several other programming languages have come into existence using Fortran’s design as their basis. The most popular is BASIC, whose base is on FORTRAN II with improved logical structures and several syntax cleanups. Fortran continues to climb heights as it makes its way up the ladder. In August 2021, the Fortran computer programming language ranked at position 13 in the TIOBE index, which measures the programming language’s popularity.
That was a remarkable improvement, bearing in mind that it ranked at position 42 on August 2020. Fortran climbing 29 slots up the ladder within a year is something worth applauding.
How to Use Fortran
Following a Fortran programming tutorial helps you understand better how to use it. Basically, a modern Fortran program comes with a collection of program units, such as the main program, external subprograms, and modules. Each program has a single main program and may or may not have other program units.
All Fortran programs begin with a keyword program and have a keyword end program, and finally, the program name closes at the end. There is an implicit none statement that enables the compiler to confirm if you have declared all your variable types correctly. Before you start any Fortran program, ensure you use the implicit none.
Fortran’s comments start with an exclamation mark, as the compiler ignores all characters after the mark, excluding the character string. The print is what commands the display of data on the screen. You can use both lowercase and uppercase letters with the Fortran, except for string literals. Also, Fortran has the indentation of code lines to keep the program readable.
An identifier is a name that identifies a procedure, variable, or other user-defined items. The name you use in a Fortran needs to adhere to the following rules:
- Do not exceed 31 characters
- Contain alphanumeric characters. That includes all alphabet letters, digits 0-9, and underscores.
- The name’s first character needs to be a letter.
Here is a guide on how to write and compile a simple Fortran program:
- Write a ‘hello world’ program. It is often the initial program to write in any programming language. When it prints on the screen, ensure that there are six spaces before every line.
- Compile the Program. To achieve this, type f77 HelloWorld.f in the command line. If you get an error, the Fortran compiler may be missing. Install it and repeat the process.
- Run the Program. If the compiler produces a file by the name a.out, run the file by typing / a . out.
- Understand What You are Writing. Program HelloWorld shows the beginning of a program, while end program HelloWorld shows the end.
- Add a Comment. Adding a comment may be unnecessary in a simple program, but you might need to write it when running a more complex program. You can add a comment in two ways: the first option is to put an exclamation mark (!) in the line where your comment begins.
The second option is to write “C” into a new line, lacking the six spaces, and there after writing your comment. For ease of readability, leave some space between the “c” and your comment.
How to Learn Fortran
Fortran is easy to learn and implement. And luckily, there are many free Fortran tutorials and books online to aid your learning process. Some of the best include:
The Difference Between Fortran and C++
C++ is an object-oriented programming language with all features supporting polymorphism and inheritance. Fortran mimics a few object-oriented features by combining its MODULE syntax elements and TYPE. However, Fortran 90 doesn’t have an automatic inheritance.
On the other hand, Fortran is easy to learn and use for scientific computing than C++. It has native support for complex numbers, multi-dimensional arrays, and other special functions. The modern Fortran has added array capabilities like array comprehensions that C++ lacks.
When it comes to speed, C++ tends to be faster than Fortran. But not by a large margin. Fortran still performs its processes at a faster rate.
Fortran Release History
Although Konrad Zuse’s Plankalkul was the first high-level programming language worldwide, the inventor’s ideas and projects were only on paper. The very first effective high-level computer programming language was Fortran of John Backus. John Warner Backus, a bachelor of mathematics graduate from Columbia University, invented his first computer programming language in the 1950s when working at IBM computer center as a programmer.
The purpose of his invention was to handle the Selective Sequence Electronic Calculator (SSEC), an electromechanical computer with about 23000 electromechanical relays and 13000 vacuum tubes. IBM computer center built the SSEC in January 1948. Wallace J. Eckert, director of IBM’s Watson Scientific Computing Laboratory, carried out moon’s orbit SSEC calculations that would appear 20 years in the Apollo space program. Since the invention of the SSEC, programing it stood out to be an uphill task to those involved. That’s because no one had set a proper way of doing it. John Backus worked on the SSEC for three years, trying to program it.
It was during that period that he came up with a program known as speedcoding. The program was the first and one of its kind to incorporate a scaling factor, which enabled storage and manipulation of both small and large numbers. In late 1953, John Backus wrote a proposal to his bosses, outlining his programming language design for IBM’s 701 mainframe computer. IBM approved John Backus’s idea and appointed him to lead a small team in 1954 at the IBM Watson Scientific Laboratory.
Backus’s team consisted of the following programmers: Richard Goldberg, Peter Sheridan, Sheldon F. Best, Harlan Herrick, Roy Nutt, Harold Stem, Irving Ziller, Robert Nelson, David Sayre, and Lois Haibt. In May 1954, IBM came up with a new computer, dubbed IBM 704 Data Processing System. It was an advanced computer with magnetic drum storage, high-speed magnetic core memory, and a tape device.
The IBM 704 computer also had an in-built scaling factor (automatic floating-point operation), the index registers, and the ability to hold up to 5 million characters. With these features, the operating time of the computer reduced significantly. But during the time, there were inefficient computer programs, which hampered the IBM 704’s high performance. And that drove Backus to think of designing a programming language that would be faster and easier for programmers to use when working with the computer.
According to Backus, the programming language would enable the computer to accept a concise problem formulation in regard to mathematical notions and automatically produce a high-speed 704 program for its functions. Here is a breakdown of the evolution of IBM’s FORTRAN.
FORTRAN I (1957)
In November 1954, Backus with his team, issued the first proposal for the programming language. During the time, Backus was anticipating to complete its compiler in six months. But instead, it took almost three years for Backus to release the first commercial FORTRAN compiler in 1957. Upon completion, the Fortran compiler had about 25000 machine code lines kept on the magnetic tape. With every IBM 704 installation, you could get a copy of the program together with a 51-page manual.
This was the initial optimizing compiler because many customers were hesitant to use a high-level programming language. They wanted a compiler generating a code with performance similar to hand-coded language assembly. Scientists and mathematicians broadly adopted John Backus’s computer programming language for writing numerically intensive programs. The move encouraged compiler writers to develop compilers with the ability to generate quicker and more efficient codes.
FORTRAN II (1958)
By adding complex number data types in the programming language, Fortran became suited for technical applications like electrical engineering. In 1958, IBM developed FORTRAN II. The main improvement was to boost procedural programming by enabling user-written functions and sub-routines. FORTRAN II also increased in statements, including subroutine, call, function, return, and end. As years went by, FORTRAN II incorporated support for complex data types and double precision.
FORTRAN III (Late 1958)
During the same year, IBM also came up with the FORTRAN III with inline assembly code and other features. Unfortunately, IBM never released the version to the public as a product. By 1960, several Fortran versions were available for IBM computers. And as Fortran continued to increase in popularity, competing computer manufacturers started providing Fortran compilers for their machines. For that reason, over 40 Fortran compilers were in existence by 1963.
FORTRAN IV (1961)
Due to public demand, IBM started working on FORTRAN IV in 1961. FORTRAN IV eliminated machine-dependent features of FORTRAN II and added new features like the logical data type. When it reached 1965, FORTRAN IV had to comply with the standards of the American Standards Association. At about the same time, FORTRAN IV had started becoming a vital educational tool, and educational facilities like the University of Waterloo were implementing it.
FORTRAN 66 (1966)
In 1966, the American Standards Association (now ANSI) decided to create a committee to develop the American Standard Fortran under BEMA sponsorship. Through the process, FORTRAN 66 was born and became the initial industry-standard version of FORTRAN. After the FORTRAN 66 standard release, compiler vendors included other extensions to the standard Fortran. The move prompted the American National Standards Institute (ANSI) in 1969 to start revising the FORTRAN 66 under CBEMA sponsorship (the Computer Business Equipment Manufacturers Association).
FORTRAN 77 (1978)
The formal approval of the new Fortran standard, dubbed FORTRAN 77, happened in April 1978. The version had an increase in features to address the shortcomings of FORTRAN 66. Due to the rapid changes in programming and computing services, there was a delay in creating a revised standard to succeed FORTRAN 77.
Fortran 90 (1992)
Later, in 1992, the much-awaited successor, named Fortran 90, was released to the public. The revision saw the change of its official name spelling from FORTRAN to Fortran. Fortran 90 also had new features to showcase the significant programming changes since the 1978 standard.
Some of the features included inline comments, modules, free-form source input, identifiers, recursive procedures, to mention but a few. Unlike the previous revision, Fortran 90 did not eliminate any existing features.
In 1995, Fortran underwent a minor revision to resolve some issues with the Fortran 90 standard. Nonetheless, Fortran 95 also added some new extensions from high-performance Fortran specifications.
Fortran: Continued Development
The year 2003 marked the beginning of the modern Fortran with object-oriented programming support. Fortran 2003 saw the introduction of new features such as input/output enhancement, data manipulation enhancement, procedure pointers, among others.
In 2010, Fortran 2008 came into existence. It was a minor upgrade, involving correction and clarification of the Fortran 2003 while including some new capabilities. These capabilities included sub-modules, Coarray Fortran, and the contiguous attribute.
The subsequent revision of the programming language was released in November 2018, dubbed Fortran 2018. It was a significant revision that included new features in the previous version. The new programming language continues to be used by scientists and mathematicians across the globe.