Fortran

ImprimirCitar

Fortran (previously FORTRAN, contraction of English The IBM Mathematical Formula Translating System) is a general-purpose, procedural, imperative, high-level programming language, which is specially adapted to numerical computation and scientific computing. Originally developed by IBM in 1957 for the IBM 704 computer, and used for scientific and engineering applications, FORTRAN came to dominate this area of programming early on and has been in continuous use for more than half a century in computationally intensive areas. such as numerical weather prediction, finite element analysis, computational fluid dynamics (CFD), computational physics, and computational chemistry. It is one of the most popular languages in the area of high-performance computing and is the language used for programs that benchmark and rank the fastest supercomputers in the world.

Fortran spans a lineage of versions, each of which evolved to add extensions to the language while usually retaining compatibility with previous versions. Successive versions have added support for character-based data processing (FORTRAN 77), array programming, modular programming, and object-oriented programming (Fortran 90/95), and generic programming (Fortran 2003).

History

FORTRAN code in a perforated card, showing the specialized use of columns 1-5, 6 and 73-80.

In late 1953, John W. Backus submitted a proposal to his superiors at IBM to develop a more practical alternative to assembly language for programming the IBM 704 mainframe computer. Backus' historic FORTRAN team consisted of programmers Richard Goldberg, Sheldon F. Best, Harlan Herrick, Peter Sheridan, Roy Nutt, Robert Nelson, Irving Ziller, Lois Haibt, and David Sayre.

In mid-1954 a draft specification for the IBM Mathematical Formula Translating System was completed. The first FORTRAN manual appeared in October 1956, because customers were reluctant to use a high-level programming language unless its compiler could generate code whose performance was comparable to hand-written assembly language code.

While the community was skeptical of this new language, it reduced the number of programming statements needed to operate a machine by 20 times, and quickly gained acceptance. During a 1979 interview with Think, IBM's employee magazine, creator John Backus said: 'A lot of my work came from being lazy. I didn't like writing programs and so when I was working on the IBM 701 writing programs to compute missile trajectories, I started working on a programming system to make it easier to write programs".

The language was widely adopted by scientists for writing numerically intensive programs, which gave compiler writers an incentive to produce compilers that could generate faster and more efficient code. The inclusion of a data type and complex number arithmetic in the language broadened the range of applications for which the language was especially suited and made FORTRAN especially suitable for technical applications such as electrical engineering.

By 1960, versions of FORTRAN were available for the IBM 709, 650, 1620, and 7090 computers. The increasing popularity of FORTRAN significantly stimulated competing computer manufacturers to provide FORTRAN compilers for their machines, thus that back in 1963 there were more than 40 FORTRAN compilers. For these reasons, FORTRAN is considered the first widely used programming language supported across a variety of computer architectures.

The development of FORTRAN paralleled the early evolution of compiler technology. In fact, many advances in compiler theory and design were specifically motivated by the need to generate efficient code for FORTRAN programs.

Versions

Some other subsequent versions were:

  • FORTRAN I
  • FORTRAN II
  • FORTRAN IV
  • FORTRAN 66
  • FORTRAN 77
  • Fortran 90
  • Fortran 95
  • Fortran 2003
  • Fortran 2008
  • Fortran 2018

Main features

The language was designed keeping in mind that programs would be written on 80-column punched cards. Thus, for example, the lines had to be numbered and the only possible alteration in the execution order was produced with the goto instruction. These features have evolved from version to version. The current ones contain subprograms, recursion, and a variety of control structures.

Advantages and disadvantages of its syntax

As it was a first attempt at creating a high-level programming language, it has a syntax considered archaic by many programmers learning more modern languages. It is difficult to write a "for" loop, and errors in typing a single character can lead to runtime errors instead of compiler errors, if the older constructs are not used. frequent. Some early versions did not have features that are considered very useful, such as dynamic memory allocation.

Note that Fortran syntax was intended for use in numerical and scientific work. Many of its shortcomings have been addressed in recent reviews of the language. For example, Fortran 95 has much shorter commands to perform mathematical operations on matrices and has types. This not only greatly improves the readability of the program but also provides useful information to the compiler.

For these reasons Fortran is rarely used outside the fields of science and numerical analysis, but it remains the preferred language for developing high-performance numerical computing applications.

Specifications

There are two standardized versions of the language.

  • ANSI X3.198-1992 (R1997). Title: Programming Language "Fortran" Extended. Known as Fortran 90. This is a standard published by ANS.l.
  • ISO/IEC 1539-1:1997. Title: Information technology - Programming languages - Fortran - Part 1: Base language. Known as Fortran 95. also adopted by ANSI.

The following shows the source code in Fortran language of a program that allows performing a linear regression or adjustment of a series of data:

REGRESION LINEAL.FORTRANSIMPLEMENTATION DIMENSION TIME(1000),PROD(1000) OPEN(1,FILE='HISTORIA.txt') I=0 10 READ(1,,END=80)T,P I=I+1 TIME(.l.)=T PROD(I)=P GO TO 10 80 NDATES=I CALL AJULIN(TIME,PROD,NDATES,A,B) WRITE(,90)A,B 90 FORMAT(' ECUATION IS:Y=',F10.2,'+',F10.2,'X') 20 FORMAT(20F10.0) END SUBROUTINE AJULIN(X,And,N,A,B) DIMENSION X(1),And(1) SUMX=0. SUMY=0. SUMX2=0. SUMY2=0 SUMXY=0 DO 20 I=1,N SUMX=SUMX+X(.l.) SUMY=SUMY+And(.l.) SUMX2=SUMX2+(X(I)X(.l())) SUMY2=SUMY2+And(I)**2 SUMXY=SUMXY+(X(I)And(I) 20 CONTINUE PROD=SUMXSUMY B=(SUMXY-PROD/N)/(SUMX2-SUMX**2/N) A=(SUMY/N-BSUMX/N) RETURN END

Basically, the program reads a certain number of ordered pairs from an ASCII file, calls a routine that calculates the corresponding line of fit, using the method of least squares, and then returns providing the coefficients or parameters of the line in question.

Portability

Portability was a problem in the early days because there was no agreed standard - not even the IBM reference manual - and computer companies competed to differentiate their offerings from others by offering incompatible features. Standards have improved portability. The 1966 standard provided reference syntax and semantics, but vendors continued to provide incompatible extensions. Although careful programmers realized that using incompatible extensions caused costly portability problems, and therefore used programs like The PFORT Verifier, it was not until after the 1977 standard, when the National Bureau of Standards (now NIST) published FIPS PUB 69, which required processors purchased by the US Government to diagnose extensions to the standard. Instead of offering two processors, essentially every compiler finally had at least one option for diagnosing extensions.

Incompatible extensions weren't the only porting problem. For numerical calculations, it is important to take into account the features of arithmetic. This was addressed by Fox et al. in the context of the 1966 standard by the PORT library. The ideas in it were widely used, eventually being incorporated into the 1990 standard by way of query intrinsics. The widespread (now nearly universal) adoption of the IEEE 754 standard for binary floating-point arithmetic has essentially eliminated this problem.

Access to the computing environment (eg, program command line, environment variables, textual explanation of error conditions) remained a problem until addressed by the 2003 standard.

Large collections of library software that could be described as loosely related to engineering and scientific calculations, such as graphics libraries, have been written in C, and therefore accessing them presented a portability problem. This has been fixed with the addition of C interop in the 2003 standard.

It is now possible (and relatively easy) to write a fully portable program in Fortran, even without resorting to a preprocessor.

Contenido relacionado

Corvette

The corvette is a warship with a displacement of between 900 and 2,000...

Secure Shell

SSH is the name of a protocol and of the program that It implements it whose main function is remote access to a server through a secure channel in which all...

Mechanics

Mechanics or the art of building a machine is the branch of physics that studies and analyzes the movement and rest of bodies, and their evolution in time...
Más resultados...
Tamaño del texto:
Copiar