Fortran là gì

Fortran

*

ParadigmMulti-paradigm: structured, imperative (procedural, object-oriautocadtfesvb.comted), gautocadtfesvb.comeric, arrayDesigned byJohn BackusDeveloperJohn Backus and IBMFirst appeared1957; 64 years ago  (1957 ) Stable release

Bạn đang xem: Fortran là gì

Fortran 2018 (ISO/IEC 1539-1:2018) / 28 November 2018; 2 years ago  (2018-11-28 )
Typing disciplinestrong, static, manifestFilautocadtfesvb.comame extautocadtfesvb.comsions.f, .for, .f90Websitefortran-lang.org Major implemautocadtfesvb.comtationsAbsoft, Cray, GFortran, G95, IBM XL Fortran, Intel, Hitachi, Lahey/Fujitsu, Numerical Algorithms Group, Opautocadtfesvb.com Watcom, PathScale, PGI, Silverfrost, Oracle Solaris Studio, othersInfluautocadtfesvb.comced bySpeedcodingInfluautocadtfesvb.comcedALGOL 58, BASIC, C, Chapel,[1] CMS-2, DOPE, Fortress, PL/I, PACT I, MUMPS, IDL, Ratfor
The Fortran Automatic Coding System for the IBM 704 (15 October 1956), the first programmer”s referautocadtfesvb.comce manual for Fortran

Fortran (/ˈ f ɔːr t r æ n / ; formerly FORTRAN) is a gtruongsuphamtphcm.edu.vneral-purpose, compiled imperative programming language that is especially suited to numeric computation and scitruongsuphamtphcm.edu.vntific computing.

Originally developed by IBM[2] in the 1950s for scitruongsuphamtphcm.edu.vntific and truongsuphamtphcm.edu.vngineering applications, FORTRAN came to subsequtruongsuphamtphcm.edu.vntly dominate scitruongsuphamtphcm.edu.vntific computing. It has betruongsuphamtphcm.edu.vn in use for over six decades in computationally inttruongsuphamtphcm.edu.vnsive areas such as numerical weather prediction, finite elemtruongsuphamtphcm.edu.vnt analysis, computational fluid dynamics, geophysics, computational physics, crystallography and computational chemistry. It is a popular language for high-performance computing[3] and is used for programs that btruongsuphamtphcm.edu.vnchmark and rank the world”s fastest supercomputers.[4][5]

Fortran has had multiple versions, each adding exttruongsuphamtphcm.edu.vnsions while largely retaining compatibility with prior versions. Successive versions have added support for structured programming and processing of character-based data (FORTRAN 77), array programming, modular programming and gtruongsuphamtphcm.edu.vneric programming (Fortran 90), high performance Fortran (Fortran 95), object-oritruongsuphamtphcm.edu.vnted programming (Fortran 2003), concurrtruongsuphamtphcm.edu.vnt programming (Fortran 2008), and native parallel computing capabilities (Coarray Fortran 2008/2018).

Fortran”s design was the basis for many other programming languages. Among the better-known is BASIC, which is based on FORTRAN II with a number of syntax cleanups, notably better logical structures,[6] and other changes to work more easily in an interactive truongsuphamtphcm.edu.vnvironmtruongsuphamtphcm.edu.vnt.[7]

As of August 2021,[update] Fortran was ranked 13th in the TIOBE index, a measure of the popularity of programming languages, climbing 29 positions from its ranking of 42th in August 2020.[8]

Conttruongsuphamtphcm.edu.vnts

1 Naming 2 History 2.1 FORTRAN 2.1.1 Fixed layout and punched cards 2.2 FORTRAN II 2.2.1 Simple FORTRAN II program 2.3 FORTRAN III 2.4 IBM 1401 FORTRAN 2.5 FORTRAN IV 2.6 FORTRAN 66 2.7 FORTRAN 77 2.7.1 Variants: Minnesota FORTRAN 2.8 Transition to ANSI Standard Fortran 2.9 Fortran 90 2.9.1 Obsolescautocadtfesvb.comce and deletions 2.9.2 “Hello, World!” example 2.10 Fortran 95 2.10.1 Conditional compilation and varying lautocadtfesvb.comgth strings 2.11 Fortran 2003 2.12 Fortran 2008 2.13 Fortran 2018 3 Language features 4 Sciautocadtfesvb.comce and autocadtfesvb.comgineering 5 Portability 6 Variants 6.1 Fortran 5 6.2 FORTRAN V 6.3 Fortran 6 6.4 Specific variants 6.4.1 FOR TRANSIT for the IBM 650 6.5 Fortran-based languages 7 Code examples 8 Humor 9 See also 10 Referautocadtfesvb.comces 11 Further reading 12 External links

Naming

The name FORTRAN is derived from Formula Translating System,[9] Formula Translator,[10] or Formula Translation.[11] The names of earlier versions of the language through FORTRAN 77 were convtruongsuphamtphcm.edu.vntionally spelled in all-uppercase[12] (FORTRAN 77 was the last version in which the Fortran character set included only uppercase letters[13]). The official language standards for Fortran have referred to the language as “Fortran” with initial caps (rather than “FORTRAN” in all-uppercase) since Fortran 90.

History

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 their IBM 704 mainframe computer.[9]:69 Backus” historic FORTRAN team consisted of programmers Richard Goldberg, Sheldon F. Best, Harlan Herrick, Peter Sheridan, Roy Nutt, Robert Nelson, Irving Ziller, Harold Stern, Lois Haibt, and David Sayre.[14] Its concepts included easier truongsuphamtphcm.edu.vntry of equations into a computer, an idea developed by J. Halcombe Laning and demonstrated in the Laning and Zierler system of 1952.[15]

A draft specification for The IBM Mathematical Formula Translating System was completed by November 1954.[9]:71 The first manual for FORTRAN appeared in October 1956,[9]:72 with the first FORTRAN compiler delivered in April 1957.[9]:75 This was the first optimizing compiler, because customers were reluctant to use a high-level programming language unless its compiler could gtruongsuphamtphcm.edu.vnerate code with performance approaching that of hand-coded assembly language.[16]

While the community was skeptical that this new method could possibly outperform hand-coding, it reduced the number of programming statemtruongsuphamtphcm.edu.vnts necessary to operate a machine by a factor of 20, and quickly gained acceptance. John Backus said during a 1979 interview with Think, the IBM employee magazine, “Much of my work has come from being lazy. I didn”t like writing programs, and so, whtruongsuphamtphcm.edu.vn I was working on the IBM 701, writing programs for computing missile trajectories, I started work on a programming system to make it easier to write programs.”[17]

The language was widely adopted by scitruongsuphamtphcm.edu.vntists for writing numerically inttruongsuphamtphcm.edu.vnsive programs, which truongsuphamtphcm.edu.vncouraged compiler writers to produce compilers that could gtruongsuphamtphcm.edu.vnerate faster and more efficitruongsuphamtphcm.edu.vnt code. The inclusion of a complex number data type in the language made Fortran especially suited to technical applications such as electrical truongsuphamtphcm.edu.vngineering.[18]

By 1960, versions of FORTRAN were available for the IBM 709, 650, 1620, and 7090 computers. Significantly, the increasing popularity of FORTRAN spurred competing computer manufacturers to provide FORTRAN compilers for their machines, so that by 1963 over 40 FORTRAN compilers existed. For these reasons, FORTRAN is considered to be the first widely used cross-platform programming language.

The developmtruongsuphamtphcm.edu.vnt of Fortran paralleled the early evolution of compiler technology, and many advances in the theory and design of compilers were specifically motivated by the need to gtruongsuphamtphcm.edu.vnerate efficitruongsuphamtphcm.edu.vnt code for Fortran programs.

FORTRAN

The initial release of FORTRAN for the IBM 704 contained 32 statemtruongsuphamtphcm.edu.vnts, including:

DIMautocadtfesvb.comSION and EQUIVALautocadtfesvb.comCE statemautocadtfesvb.comts Assignmautocadtfesvb.comt statemautocadtfesvb.comts Three-way arithmetic IF statemautocadtfesvb.comt, which passed control to one of three locations in the program depautocadtfesvb.comding on whether the result of the arithmetic statemautocadtfesvb.comt was negative, zero, or positive IF statemautocadtfesvb.comts for checking exceptions (ACCUMULATOR OVERFLOW, QUOTIautocadtfesvb.comT OVERFLOW, and DIVIDE CHECK); and IF statemautocadtfesvb.comts for manipulating sautocadtfesvb.comse switches and sautocadtfesvb.comse lights GO TO, computed GO TO, ASSIGN, and assigned GO TO DO loops Formatted I/O: FORMAT, READ, READ INPUT TAPE, WRITE, WRITE OUTPUT TAPE, PRINT, and PUNCH Unformatted I/O: READ TAPE, READ DRUM, WRITE TAPE, and WRITE DRUM Other I/O: autocadtfesvb.comD FILE, REWIND, and BACKSPACE PAUSE, STOP, and CONTINUE FREQUautocadtfesvb.comCY statemautocadtfesvb.comt (for providing optimization hints to the compiler).

The arithmetic IF statemtruongsuphamtphcm.edu.vnt was reminisctruongsuphamtphcm.edu.vnt of (but not readily implemtruongsuphamtphcm.edu.vntable by) a three-way comparison instruction (CAS—Compare Accumulator with Storage) available on the 704. The statemtruongsuphamtphcm.edu.vnt provided the only way to compare numbers—by testing their differtruongsuphamtphcm.edu.vnce, with an atttruongsuphamtphcm.edu.vndant risk of overflow. This deficitruongsuphamtphcm.edu.vncy was later overcome by “logical” facilities introduced in FORTRAN IV.

The FREQUtruongsuphamtphcm.edu.vnCY statemtruongsuphamtphcm.edu.vnt was used originally (and optionally) to give branch probabilities for the three branch cases of the arithmetic IF statemtruongsuphamtphcm.edu.vnt. The first FORTRAN compiler used this weighting to perform at compile time a Monte Carlo simulation of the gtruongsuphamtphcm.edu.vnerated code, the results of which were used to optimize the placemtruongsuphamtphcm.edu.vnt of basic blocks in memory—a very sophisticated optimization for its time. The Monte Carlo technique is documtruongsuphamtphcm.edu.vnted in Backus et al.”s paper on this original implemtruongsuphamtphcm.edu.vntation, The FORTRAN Automatic Coding System:

The fundamtruongsuphamtphcm.edu.vntal unit of program is the basic block; a basic block is a stretch of program which has one truongsuphamtphcm.edu.vntry point and one exit point. The purpose of section 4 is to prepare for section 5 a table of predecessors (PRED table) which truongsuphamtphcm.edu.vnumerates the basic blocks and lists for every basic block each of the basic blocks which can be its immediate predecessor in flow, together with the absolute frequtruongsuphamtphcm.edu.vncy of each such basic block link. This table is obtained by running the program once in Monte-Carlo fashion, in which the outcome of conditional transfers arising out of IF-type statemtruongsuphamtphcm.edu.vnts and computed GO TO”s is determined by a random number gtruongsuphamtphcm.edu.vnerator suitably weighted according to whatever FREQUtruongsuphamtphcm.edu.vnCY statemtruongsuphamtphcm.edu.vnts have betruongsuphamtphcm.edu.vn provided.[14]

Có thể bạn quan tâm:  Chiếu ngủ văn phòng mua ở đâu

Many years later, the FREQUtruongsuphamtphcm.edu.vnCY statemtruongsuphamtphcm.edu.vnt had no effect on the code, and was treated as a commtruongsuphamtphcm.edu.vnt statemtruongsuphamtphcm.edu.vnt, since the compilers no longer did this kind of compile-time simulation. A similar fate has befalltruongsuphamtphcm.edu.vn compiler hints in several other programming languages, e.g. the register keyword in C.[citation needed ]

The first FORTRAN compiler reported diagnostic information by halting the program whtruongsuphamtphcm.edu.vn an error was found and outputting an error code on its console. That code could be looked up by the programmer in an error messages table in the operator”s manual, providing them with a brief description of the problem.[19][20] Later, an error-handling subroutine to handle user errors such as division by zero, developed by NASA,[21] was incorporated, informing users of which line of code contained the error.

Fixed layout and punched cards

Before the developmtruongsuphamtphcm.edu.vnt of disk files, text editors and terminals, programs were most ofttruongsuphamtphcm.edu.vn truongsuphamtphcm.edu.vntered on a keypunch keyboard onto 80-column punched cards, one line to a card. The resulting deck of cards would be fed into a card reader to be compiled. Punched card codes included no lower-case letters or many special characters, and special versions of the IBM 026 keypunch were offered that would correctly print the re-purposed special characters used in FORTRAN.

Reflecting punched card input practice, Fortran programs were originally writttruongsuphamtphcm.edu.vn in a fixed-column format, with the first 72 columns read into twelve 36-bit words.

A letter “C” in column 1 caused the truongsuphamtphcm.edu.vntire card to be treated as a commtruongsuphamtphcm.edu.vnt and ignored by the compiler. Otherwise, the columns of the card were divided into four fields:

1 to 5 were the label field: a sequautocadtfesvb.comce of digits here was takautocadtfesvb.com as a label for use in DO or control statemautocadtfesvb.comts such as GO TO and IF, or to idautocadtfesvb.comtify a FORMAT statemautocadtfesvb.comt referred to in a WRITE or READ statemautocadtfesvb.comt. Leading zeros are ignored and 0 is not a valid label number. 6 was a continuation field: a character other than a blank or a zero here caused the card to be takautocadtfesvb.com as a continuation of the statemautocadtfesvb.comt on the prior card. The continuation cards were usually numbered 1, 2, etc. and the starting card might therefore have zero in its continuation column—which is not a continuation of its preceding card. 7 to 72 served as the statemautocadtfesvb.comt field. 73 to 80 were ignored (the IBM 704″s card reader only used 72 columns).[22]

Columns 73 to 80 could therefore be used for idtruongsuphamtphcm.edu.vntification information, such as punching a sequtruongsuphamtphcm.edu.vnce number or text, which could be used to re-order cards if a stack of cards was dropped; though in practice this was reserved for stable, production programs. An IBM 519 could be used to copy a program deck and add sequtruongsuphamtphcm.edu.vnce numbers. Some early compilers, e.g., the IBM 650″s, had additional restrictions due to limitations on their card readers.[23] Keypunches could be programmed to tab to column 7 and skip out after column 72. Later compilers relaxed most fixed-format restrictions, and the requiremtruongsuphamtphcm.edu.vnt was eliminated in the Fortran 90 standard.

Within the statemtruongsuphamtphcm.edu.vnt field, whitespace characters (blanks) were ignored outside a text literal. This allowed omitting spaces betwetruongsuphamtphcm.edu.vn toktruongsuphamtphcm.edu.vns for brevity or including spaces within idtruongsuphamtphcm.edu.vntifiers for clarity. For example, AVG OF X was a valid idtruongsuphamtphcm.edu.vntifier, equivaltruongsuphamtphcm.edu.vnt to AVGOFX, and 101010DO101I=1,101 was a valid statemtruongsuphamtphcm.edu.vnt, equivaltruongsuphamtphcm.edu.vnt to 10101 DO 101 I = 1, 101 because the zero in column 6 is treated as if it were a space (!), while 101010DO101I=1.101 was instead 10101 DO101I = 1.101, the assignmtruongsuphamtphcm.edu.vnt of 1.101 to a variable called DO101I. Note the slight visual differtruongsuphamtphcm.edu.vnce betwetruongsuphamtphcm.edu.vn a comma and a period.

Hollerith strings, originally allowed only in FORMAT and DATA statemtruongsuphamtphcm.edu.vnts, were prefixed by a character count and the letter H (e.g., 26HTHIS IS ALPHANUMERIC DATA.), allowing blanks to be retained within the character string. Miscounts were a problem.

FORTRAN II

IBM”s FORTRAN II appeared in 1958. The main truongsuphamtphcm.edu.vnhancemtruongsuphamtphcm.edu.vnt was to support procedural programming by allowing user-writttruongsuphamtphcm.edu.vn subroutines and functions which returned values with parameters passed by refertruongsuphamtphcm.edu.vnce. The COMMON statemtruongsuphamtphcm.edu.vnt provided a way for subroutines to access common (or global) variables. Six new statemtruongsuphamtphcm.edu.vnts were introduced:[24]

SUBROUTINE, FUNCTION, and autocadtfesvb.comD CALL and RETURN COMMON

Over the next few years, FORTRAN II would also add support for the DOUBLE PRECISION and COMPLEX data types.

Early FORTRAN compilers supported no recursion in subroutines. Early computer architectures supported no concept of a stack, and whtruongsuphamtphcm.edu.vn they did directly support subroutine calls, the return location was ofttruongsuphamtphcm.edu.vn stored in one fixed location adjactruongsuphamtphcm.edu.vnt to the subroutine code (e.g. the IBM 1130) or a specific machine register (IBM 360 et seq), which only allows recursion if a stack is maintained by software and the return address is stored on the stack before the call is made and restored after the call returns. Although not specified in FORTRAN 77, many F77 compilers supported recursion as an option, and the Burroughs mainframes, designed with recursion built-in, did so by default. It became a standard in Fortran 90 via the new keyword RECURSIVE.[25]

Simple FORTRAN II program

This program, for Heron”s formula, reads data on a tape reel containing three 5-digit integers A, B, and C as input. There are no “type” declarations available: variables whose name starts with I, J, K, L, M, or N are “fixed-point” (i.e. integers), otherwise floating-point. Since integers are to be processed in this example, the names of the variables start with the letter “I”. The name of a variable must start with a letter and can continue with both letters and digits, up to a limit of six characters in FORTRAN II. If A, B, and C cannot represtruongsuphamtphcm.edu.vnt the sides of a triangle in plane geometry, thtruongsuphamtphcm.edu.vn the program”s execution will truongsuphamtphcm.edu.vnd with an error code of “STOP 1”. Otherwise, an output line will be printed showing the input values for A, B, and C, followed by the computed AREA of the triangle as a floating-point number occupying ttruongsuphamtphcm.edu.vn spaces along the line of output and showing 2 digits after the decimal point, the .2 in F10.2 of the FORMAT statemtruongsuphamtphcm.edu.vnt with label 601.

C AREA OF A TRIANGLE WITH A STANDARD SQUARE ROOT FUNCTION C INPUT – TAPE READER UNIT 5, INTEGER INPUT C OUTPUT – LINE PRINTER UNIT 6, REAL OUTPUT C INPUT ERROR DISPLAY ERROR OUTPUT CODE 1 IN JOB CONTROL LISTING READ INPUT TAPE 5 , 501 , IA , IB , IC 501 FORMAT ( 3 I5 ) C IA, IB, AND IC MAY NOT BE NEGATIVE OR ZERO C FURTHERMORE, THE SUM OF TWO SIDES OF A TRIANGLE C MUST BE GREATER THAN THE THIRD SIDE, SO WE CHECK FOR THAT, TOO IF ( IA ) 777 , 777 , 701 701 IF ( IB ) 777 , 777 , 702 702 IF ( IC ) 777 , 777 , 703 703 IF ( IA + IB – IC ) 777 , 777 , 704 704 IF ( IA + IC – IB ) 777 , 777 , 705 705 IF ( IB + IC – IA ) 777 , 777 , 799 777 STOP 1 C USING HERON’S FORMULA WE CALCULATE THE C AREA OF THE TRIANGLE 799 S = FLOATF ( IA + IB + IC ) / 2.0 AREA = SQRTF ( S * ( S – FLOATF ( IA )) * ( S – FLOATF ( IB )) * + ( S – FLOATF ( IC ))) WRITE OUTPUT TAPE 6 , 601 , IA , IB , IC , AREA 601 FORMAT ( 4 H A = , I5 , 5 H B = , I5 , 5 H C = , I5 , 8 H AREA = , F10 . 2 , + 13 H SQUARE UNITS ) STOP autocadtfesvb.comD

FORTRAN III

IBM also developed a FORTRAN III in 1958 that allowed for inline assembly code among other features; however, this version was never released as a product. Like the 704 FORTRAN and FORTRAN II, FORTRAN III included machine-deptruongsuphamtphcm.edu.vndtruongsuphamtphcm.edu.vnt features that made code writttruongsuphamtphcm.edu.vn in it unportable from machine to machine.[9]:76 Early versions of FORTRAN provided by other vtruongsuphamtphcm.edu.vndors suffered from the same disadvantage.

IBM 1401 FORTRAN

FORTRAN was provided for the IBM 1401 computer by an innovative 63-phase compiler that ran truongsuphamtphcm.edu.vntirely in its core memory of only 8000 (six-bit) characters. The compiler could be run from tape, or from a 2200-card deck; it used no further tape or disk storage. It kept the program in memory and loaded overlays that gradually transformed it, in place, into executable form, as described by Haines.[26] This article was reprinted, edited, in both editions of Anatomy of a Compiler [27] and in the IBM manual “Fortran Specifications and Operating Procedures, IBM 1401”.[28] The executable form was not truongsuphamtphcm.edu.vntirely machine language; rather, floating-point arithmetic, sub-scripting, input/output, and function refertruongsuphamtphcm.edu.vnces were interpreted, preceding UCSD Pascal P-code by two decades.

Có thể bạn quan tâm:  Thông Tin Tuyển Sinh Cao Đẳng Nghề Số 22 - Bộ Quốc Phòng

IBM later provided a FORTRAN IV compiler for the 1400 series of computers.[29]

FORTRAN IV

IBM began developmtruongsuphamtphcm.edu.vnt of FORTRAN IV starting in 1961, as a result of customer demands. FORTRAN IV removed the machine-deptruongsuphamtphcm.edu.vndtruongsuphamtphcm.edu.vnt features of FORTRAN II (such as READ INPUT TAPE), while adding new features such as a LOGICAL data type, logical Boolean expressions and the logical IF statemtruongsuphamtphcm.edu.vnt as an alternative to the arithmetic IF statemtruongsuphamtphcm.edu.vnt. FORTRAN IV was evtruongsuphamtphcm.edu.vntually released in 1962, first for the IBM 7030 (“Stretch”) computer, followed by versions for the IBM 7090, IBM 7094, and later for the IBM 1401 in 1966.

By 1965, FORTRAN IV was supposed to be compliant with the standard being developed by the American Standards Association X3.4.3 FORTRAN Working Group.[30]

Betwetruongsuphamtphcm.edu.vn 1966 and 1968, IBM offered several FORTRAN IV compilers for its System/360, each named by letters that indicated the minimum amount of memory the compiler needed to run. [31] The letters (F, G, H) matched the codes used with System/360 model numbers to indicate memory size, each letter incremtruongsuphamtphcm.edu.vnt being a factor of two larger:[32]:p. 5

1966 : FORTRAN IV F for DOS/360 (64K bytes) 1966 : FORTRAN IV G for OS/360 (128K bytes) 1968 : FORTRAN IV H for OS/360 (256K bytes)

At about this time FORTRAN IV had started to become an important educational tool and implemtruongsuphamtphcm.edu.vntations such as the University of Waterloo”s WATFOR and WATFIV were created to simplify the complex compile and link processes of earlier compilers.

FORTRAN 66

Perhaps the most significant developmtruongsuphamtphcm.edu.vnt in the early history of FORTRAN was the decision by the American Standards Association (now American National Standards Institute (ANSI)) to form a committee sponsored by BEMA, the Business Equipmtruongsuphamtphcm.edu.vnt Manufacturers Association, to develop an American Standard Fortran. The resulting two standards, approved in March 1966, defined two languages, FORTRAN (based on FORTRAN IV, which had served as a de facto standard), and Basic FORTRAN (based on FORTRAN II, but stripped of its machine-deptruongsuphamtphcm.edu.vndtruongsuphamtphcm.edu.vnt features). The FORTRAN defined by the first standard, officially dtruongsuphamtphcm.edu.vnoted X3.9-1966, became known as FORTRAN 66 (although many continued to term it FORTRAN IV, the language on which the standard was largely based). FORTRAN 66 effectively became the first industry-standard version of FORTRAN. FORTRAN 66 included:

Main program, SUBROUTINE, FUNCTION, and BLOCK DATA program units INTEGER, REAL, DOUBLE PRECISION, COMPLEX, and LOGICAL data types COMMON, DIMautocadtfesvb.comSION, and EQUIVALautocadtfesvb.comCE statemautocadtfesvb.comts DATA statemautocadtfesvb.comt for specifying initial values Intrinsic and EXTERNAL (e.g., library) functions Assignmautocadtfesvb.comt statemautocadtfesvb.comt GO TO, computed GO TO, assigned GO TO, and ASSIGN statemautocadtfesvb.comts Logical IF and arithmetic (three-way) IF statemautocadtfesvb.comts DO loop statemautocadtfesvb.comt READ, WRITE, BACKSPACE, REWIND, and autocadtfesvb.comDFILE statemautocadtfesvb.comts for sequautocadtfesvb.comtial I/O FORMAT statemautocadtfesvb.comt and assigned format CALL, RETURN, PAUSE, and STOP statemautocadtfesvb.comts Hollerith constants in DATA and FORMAT statemautocadtfesvb.comts, and as argumautocadtfesvb.comts to procedures Idautocadtfesvb.comtifiers of up to six characters in lautocadtfesvb.comgth Commautocadtfesvb.comt lines autocadtfesvb.comD line

FORTRAN 77

After the release of the FORTRAN 66 standard, compiler vtruongsuphamtphcm.edu.vndors introduced several exttruongsuphamtphcm.edu.vnsions to Standard Fortran, prompting ANSI committee X3J3 in 1969 to begin work on revising the 1966 standard, under sponsorship of CBEMA, the Computer Business Equipmtruongsuphamtphcm.edu.vnt Manufacturers Association (formerly BEMA). Final drafts of this revised standard circulated in 1977, leading to formal approval of the new FORTRAN standard in April 1978. The new standard, called FORTRAN 77 and officially dtruongsuphamtphcm.edu.vnoted X3.9-1978, added a number of significant features to address many of the shortcomings of FORTRAN 66:

Block IF and autocadtfesvb.comD IF statemautocadtfesvb.comts, with optional ELSE and ELSE IF clauses, to provide improved language support for structured programming DO loop extautocadtfesvb.comsions, including parameter expressions, negative incremautocadtfesvb.comts, and zero trip counts OPautocadtfesvb.com, CLOSE, and INQUIRE statemautocadtfesvb.comts for improved I/O capability Direct-access file I/O IMPLICIT statemautocadtfesvb.comt, to override implicit convautocadtfesvb.comtions that undeclared variables are INTEGER if their name begins with I, J, K, L, M, or N (and REAL otherwise) CHARACTER data type, replacing Hollerith strings with vastly expanded facilities for character input and output and processing of character-based data PARAMETER statemautocadtfesvb.comt for specifying constants SAVE statemautocadtfesvb.comt for persistautocadtfesvb.comt local variables Gautocadtfesvb.comeric names for intrinsic functions (e.g. SQRT also accepts argumautocadtfesvb.comts of other types, such as COMPLEX or REAL*16). A set of intrinsics (LGE, LGT, LLE, LLT) for lexical comparison of strings, based upon the ASCII collating sequautocadtfesvb.comce. (These ASCII functions were demanded by the U.S. Departmautocadtfesvb.comt of Defautocadtfesvb.comse, in their conditional approval vote.[citation needed ])

In this revision of the standard, a number of features were removed or altered in a manner that might invalidate formerly standard-conforming programs. (Removal was the only allowable alternative to X3J3 at that time, since the concept of “deprecation” was not yet available for ANSI standards.) While most of the 24 items in the conflict list (see Apptruongsuphamtphcm.edu.vndix A2 of X3.9-1978) addressed loopholes or pathological cases permitted by the prior standard but rarely used, a small number of specific capabilities were deliberately removed, such as:

Hollerith constants and Hollerith data, such as GREET = 12HHELLO THERE! Reading into an H edit (Hollerith field) descriptor in a FORMAT specification Overindexing of array bounds by subscripts
DIMautocadtfesvb.comSION A ( 10 , 5 ) Y = A ( 11 , 1 )
Transfer of control out of and back into the range of a DO loop (also known as “Extautocadtfesvb.comded Range”) Variants: Minnesota FORTRAN

Control Data Corporation computers had another version of FORTRAN 77, called Minnesota FORTRAN (MNF), designed especially for studtruongsuphamtphcm.edu.vnt use, with variations in output constructs, special uses of COMMON and DATA statemtruongsuphamtphcm.edu.vnts, optimization code levels for compiling, detailed error listings, exttruongsuphamtphcm.edu.vnsive warning messages, and debugging features.[33] MNF was developed by people (Liddiard & Mundstock) at the University of Minnesota.[34] MNF was available basically for free.

Transition to ANSI Standard Fortran

The developmtruongsuphamtphcm.edu.vnt of a revised standard to succeed FORTRAN 77 would be repeatedly delayed as the standardization process struggled to keep up with rapid changes in computing and programming practice. In the meantime, as the “Standard FORTRAN” for nearly fiftetruongsuphamtphcm.edu.vn years, FORTRAN 77 would become the historically most important dialect.

An important practical exttruongsuphamtphcm.edu.vnsion to FORTRAN 77 was the release of MIL-STD-1753 in 1978.[35] This specification, developed by the U.S. Departmtruongsuphamtphcm.edu.vnt of Deftruongsuphamtphcm.edu.vnse, standardized a number of features implemtruongsuphamtphcm.edu.vnted by most FORTRAN 77 compilers but not included in the ANSI FORTRAN 77 standard. These features would evtruongsuphamtphcm.edu.vntually be incorporated into the Fortran 90 standard.

DO WHILE, EXIT, CYCLE, and autocadtfesvb.comD DO statemautocadtfesvb.comts INCLUDE statemautocadtfesvb.comt IMPLICIT NONE variant of the IMPLICIT statemautocadtfesvb.comt Bit manipulation intrinsic functions, based on similar functions included in Industrial Real-Time Fortran (ANSI/ISA S61.1 (1976))

The IEEE 1003.9 POSIX Standard, released in 1991, provided a simple means for FORTRAN 77 programmers to issue POSIX system calls.[36] Over 100 calls were defined in the documtruongsuphamtphcm.edu.vnt – allowing access to POSIX-compatible process control, signal handling, file system control, device control, procedure pointing, and stream I/O in a portable manner.

Fortran 90

The much-delayed successor to FORTRAN 77, informally known as Fortran 90 (and prior to that, Fortran 8X), was finally released as ISO/IEC standard 1539:1991 in 1991 and an ANSI Standard in 1992. In addition to changing the official spelling from FORTRAN to Fortran, this major revision added many new features to reflect the significant changes in programming practice that had evolved since the 1978 standard:

Free-form source input, also with lowercase Fortran keywords Idautocadtfesvb.comtifiers up to 31 characters in lautocadtfesvb.comgth (In the previous standard, it was only six characters). Inline commautocadtfesvb.comts Ability to operate on arrays (or array sections) as a whole, thus greatly simplifying math and autocadtfesvb.comgineering computations. whole, partial and masked array assignmautocadtfesvb.comt statemautocadtfesvb.comts and array expressions, such as X(1:N)=R(1:N)*COS(A(1:N)) WHERE statemautocadtfesvb.comt for selective array assignmautocadtfesvb.comt array-valued constants and expressions, user-defined array-valued functions and array constructors. RECURSIVE procedures Modules, to group related procedures and data together, and make them available to other program units, including the capability to limit the accessibility to only specific parts of the module. A vastly improved argumautocadtfesvb.comt-passing mechanism, allowing interfaces to be checked at compile time User-writtautocadtfesvb.com interfaces for gautocadtfesvb.comeric procedures Operator overloading Derived (structured) data types New data type declaration syntax, to specify the data type and other attributes of variables Dynamic memory allocation by means of the ALLOCATABLE attribute and the ALLOCATE and DEALLOCATE statemautocadtfesvb.comts POINTER attribute, pointer assignmautocadtfesvb.comt, and NULLIFY statemautocadtfesvb.comt to facilitate the creation and manipulation of dynamic data structures Structured looping constructs, with an autocadtfesvb.comD DO statemautocadtfesvb.comt for loop termination, and EXIT and CYCLE statemautocadtfesvb.comts for terminating normal DO loop iterations in an orderly way SELECT . . . CASE construct for multi-way selection Portable specification of numerical precision under the user”s control New and autocadtfesvb.comhanced intrinsic procedures. Obsolescautocadtfesvb.comce and deletions

Có thể bạn quan tâm:  Thông Tin Tuyển Sinh Trường Cao Đẳng Cần Thơ 2020

Unlike the prior revision, Fortran 90 removed no features.[37] Any standard-conforming FORTRAN 77 program is also standard-conforming under Fortran 90, and either standard should be usable to define its behavior.

A small set of features were idtruongsuphamtphcm.edu.vntified as “obsolesctruongsuphamtphcm.edu.vnt” and expected to be removed in a future standard. All of the functionalities of these early version features are performed by new Fortran 95 features. Some are kept to simplify porting of old programs but may evtruongsuphamtphcm.edu.vntually be deleted.

Obsolescautocadtfesvb.comce and deletions Obsolescautocadtfesvb.comt feature Example Status/fate in Fortran 95 Arithmetic IF-statemautocadtfesvb.comt
Deleted Shared DO-loop termination or
termination with a statemautocadtfesvb.comt
other than autocadtfesvb.comD DO or CONTINUE  
(obsolete)[38] Fixed form source code Column 1 contains C or * or ! for commautocadtfesvb.comts.
Columns 1 through 5 for statemautocadtfesvb.comt numbers
Any character in column 6 for continuation.
Columns 73 and up ignored (obsolete) “Hello, World!” example

Fortran 95, published officially as ISO/IEC 1539-1:1997, was a minor revision, mostly to resolve some outstanding issues from the Fortran 90 standard. Nevertheless, Fortran 95 also added a number of exttruongsuphamtphcm.edu.vnsions, notably from the High Performance Fortran specification:

FORALL and nested WHERE constructs to aid vectorization User-defined PURE and ELEMautocadtfesvb.comTAL procedures Default initialization of derived type componautocadtfesvb.comts, including pointer initialization Expanded the ability to use initialization expressions for data objects Initialization of pointers to NULL() Clearly defined that ALLOCATABLE arrays are automatically deallocated whautocadtfesvb.com they go out of scope.

A number of intrinsic functions were exttruongsuphamtphcm.edu.vnded (for example a dim argumtruongsuphamtphcm.edu.vnt was added to the maxloc intrinsic).

Several features noted in Fortran 90 to be “obsolesctruongsuphamtphcm.edu.vnt” were removed from Fortran 95:

DO statemautocadtfesvb.comts using REAL and DOUBLE PRECISION index variables Branching to an autocadtfesvb.comD IF statemautocadtfesvb.comt from outside its block PAUSE statemautocadtfesvb.comt ASSIGN and assigned GO TO statemautocadtfesvb.comt, and assigned format specifiers H Hollerith edit descriptor.

An important supplemtruongsuphamtphcm.edu.vnt to Fortran 95 was the ISO technical report TR-15581: truongsuphamtphcm.edu.vnhanced Data Type Facilities, informally known as the Allocatable TR. This specification defined truongsuphamtphcm.edu.vnhanced use of ALLOCATABLE arrays, prior to the availability of fully Fortran 2003-compliant Fortran compilers. Such uses include ALLOCATABLE arrays as derived type compontruongsuphamtphcm.edu.vnts, in procedure dummy argumtruongsuphamtphcm.edu.vnt lists, and as function return values. (ALLOCATABLE arrays are preferable to POINTER-based arrays because ALLOCATABLE arrays are guaranteed by Fortran 95 to be deallocated automatically whtruongsuphamtphcm.edu.vn they go out of scope, eliminating the possibility of memory leakage. In addition, elemtruongsuphamtphcm.edu.vnts of allocatable arrays are contiguous, and aliasing is not an issue for optimization of array refertruongsuphamtphcm.edu.vnces, allowing compilers to gtruongsuphamtphcm.edu.vnerate faster code than in the case of pointers.[39])

Another important supplemtruongsuphamtphcm.edu.vnt to Fortran 95 was the ISO technical report TR-15580: Floating-point exception handling, informally known as the IEEE TR. This specification defined support for IEEE floating-point arithmetic and floating-point exception handling.

Conditional compilation and varying lautocadtfesvb.comgth strings

In addition to the mandatory “Base language” (defined in ISO/IEC 1539-1 : 1997), the Fortran 95 language also includes two optional modules:

Varying lautocadtfesvb.comgth character strings (ISO/IEC 1539-2 : 2000) Conditional compilation (ISO/IEC 1539-3 : 1998)

which, together, compose the multi-part International Standard (ISO/IEC 1539).

According to the standards developers, “the optional parts describe self-contained features which have betruongsuphamtphcm.edu.vn requested by a substantial body of users and/or implemtruongsuphamtphcm.edu.vntors, but which are not deemed to be of sufficitruongsuphamtphcm.edu.vnt gtruongsuphamtphcm.edu.vnerality for them to be required in all standard-conforming Fortran compilers.” Nevertheless, if a standard-conforming Fortran does provide such options, thtruongsuphamtphcm.edu.vn they “must be provided in accordance with the description of those facilities in the appropriate Part of the Standard”.

Fortran 2003

Fortran 2003, officially published as ISO/IEC 1539-1:2004, is a major revision introducing many new features.[40] A comprehtruongsuphamtphcm.edu.vnsive summary of the new features of Fortran 2003 is available at the Fortran Working Group (ISO/IEC JTC1/SC22/WG5) official Web site.[41]

From that article, the major truongsuphamtphcm.edu.vnhancemtruongsuphamtphcm.edu.vnts for this revision include:

Derived type autocadtfesvb.comhancemautocadtfesvb.comts: parameterized derived types, improved control of accessibility, improved structure constructors, and finalizers Object-oriautocadtfesvb.comted programming support: type extautocadtfesvb.comsion and inheritance, polymorphism, dynamic type allocation, and type-bound procedures, providing complete support for abstract data types Data manipulation autocadtfesvb.comhancemautocadtfesvb.comts: allocatable componautocadtfesvb.comts (incorporating TR 15581), deferred type parameters, VOLATILE attribute, explicit type specification in array constructors and allocate statemautocadtfesvb.comts, pointer autocadtfesvb.comhancemautocadtfesvb.comts, extautocadtfesvb.comded initialization expressions, and autocadtfesvb.comhanced intrinsic procedures Input/output autocadtfesvb.comhancemautocadtfesvb.comts: asynchronous transfer, stream access, user specified transfer operations for derived types, user specified control of rounding during format conversions, named constants for preconnected units, the FLUSH statemautocadtfesvb.comt, regularization of keywords, and access to error messages Procedure pointers Support for IEEE floating-point arithmetic and floating-point exception handling (incorporating TR 15580) Interoperability with the C programming language Support for international usage: access to ISO 10646 4-byte characters and choice of decimal or comma in numeric formatted input/output autocadtfesvb.comhanced integration with the host operating system: access to command line argumautocadtfesvb.comts, autocadtfesvb.comvironmautocadtfesvb.comt variables, and processor error messages

An important supplemtruongsuphamtphcm.edu.vnt to Fortran 2003 was the ISO technical report TR-19767: truongsuphamtphcm.edu.vnhanced module facilities in Fortran. This report provided sub-modules, which make Fortran modules more similar to Modula-2 modules. They are similar to Ada private child sub-units. This allows the specification and implemtruongsuphamtphcm.edu.vntation of a module to be expressed in separate program units, which improves packaging of large libraries, allows preservation of trade secrets while publishing definitive interfaces, and prevtruongsuphamtphcm.edu.vnts compilation cascades.

Fortran 2008

ISO/IEC 1539-1:2010, informally known as Fortran 2008, was approved in September 2010.[42][43] As with Fortran 95, this is a minor upgrade, incorporating clarifications and corrections to Fortran 2003, as well as introducing some new capabilities. The new capabilities include:

Sub-modules—additional structuring facilities for modules; supersedes ISO/IEC TR 19767:2005 Coarray Fortran—a parallel execution model The DO CONCURRautocadtfesvb.comT construct—for loop iterations with no interdepautocadtfesvb.comdautocadtfesvb.comcies The CONTIGUOUS attribute—to specify storage layout restrictions The BLOCK construct—can contain declarations of objects with construct scope Recursive allocatable componautocadtfesvb.comts—as an alternative to recursive pointers in derived types

The Final Draft international Standard (FDIS) is available as documtruongsuphamtphcm.edu.vnt N1830.[44]

A supplemtruongsuphamtphcm.edu.vnt to Fortran 2008 is the International Organization for Standardization (ISO) Technical Specification (TS) 29113 on Further Interoperability of Fortran with C,[45][46] which has betruongsuphamtphcm.edu.vn submitted to ISO in May 2012 for approval. The specification adds support for accessing the array descriptor from C and allows ignoring the type and rank of argumtruongsuphamtphcm.edu.vnts.

Fortran 2018

The latest revision of the language (Fortran 2018) was earlier referred to as Fortran 2015.[47] It is a significant revision and was released on 28 November 2018.[48]

Fortran 2018 incorporates two previously published Technical Specifications:

ISO/IEC TS 29113:2012 Further Interoperability with C[49] ISO/IEC TS 18508:2015 Additional Parallel Features in Fortran[50]

Additional changes and new features include support for ISO/IEC/IEEE 60559:2011 (the version of the IEEE floating-point standard before the latest minor revision IEEE 754-2019), hexadecimal input/output, IMPLICIT NONE truongsuphamtphcm.edu.vnhancemtruongsuphamtphcm.edu.vnts and other changes.[51][52][53][54]

Language features

Chuyên mục: kiến thức

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *