New Immissions/Updates:
boundless - educate - edutalab - empatico - es-ebooks - es16 - fr16 - fsfiles - hesperian - solidaria - wikipediaforschools
- wikipediaforschoolses - wikipediaforschoolsfr - wikipediaforschoolspt - worldmap -

See also: Liber Liber - Libro Parlato - Liber Musica  - Manuzio -  Liber Liber ISO Files - Alphabetical Order - Multivolume ZIP Complete Archive - PDF Files - OGG Music Files -

PROJECT GUTENBERG HTML: Volume I - Volume II - Volume III - Volume IV - Volume V - Volume VI - Volume VII - Volume VIII - Volume IX

Ascolta ""Volevo solo fare un audiolibro"" su Spreaker.
CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
Fortran - Wikipedia

Fortran

维基百科,自由的百科全书

Fortran,亦譯為福傳,是由Formula Translation两个字所组合而成,意思是「公式翻译」。它是世界上第一个被正式采用並流传至今的zh-cn:高级;zh-tw:高階zh-cn:编程;zh-tw:程式語言

目录

[编辑] 历史

古老的IBM 704大型主機。本圖由Lawrence Livermore National Laboratory(LLNL)提供
古老的IBM 704大型主機。本圖由Lawrence Livermore National Laboratory(LLNL)提供
FORTRAN 發明的年代還沒有鍵盤與螢幕,程式碼必須使用打卡機打在打孔卡(punch card)上。圖中顯示卡片上的1-5行、第6行與73-80行被使用過。
FORTRAN 發明的年代還沒有鍵盤與螢幕,程式碼必須使用打卡機打在打孔卡(punch card)上。圖中顯示卡片上的1-5行、第6行與73-80行被使用過。

Fortran语言最初是由数值计算方面的需要而发展起来的。1953年12月,IBM公司程式員約翰·巴科斯(J. Backus)深深體會到編寫程序的困難性,他寫了一份備忘錄給董事長斯伯特·赫德(Cuthbert Hurd),建議為IBM704系統設計一套全新的電腦語言,從根本上提高編程效率。当时IBM公司顾问冯·诺伊曼强烈反对這項建議,他认为巴克斯的建议是没有必要的,而且不切實際。但赫德批准了這項計劃。1957年IBM公司开发出第一套FORTRAN语言,运行在IBM704计算机上。歷史上第一支FORTRAN程式在馬里蘭州的西屋貝地斯核電廠試驗。1957年4月20日星期五的下午,一位IBM程式員決定在電廠內編譯第一支FORTRAN程式,當程式碼輸入後,經過編譯,印表機列出一道訊息:“原始程式錯誤……右側括號後面沒有逗號”,現場人員都感到訝異,這個錯誤經過修正之後,程式編譯器再度執行,二十二分鐘後,印表機輸出正確結果。西屋電氣公司意外地成為FORTRAN的第一個商業用戶。1958年推出FORTRAN Ⅱ,幾年後又推出FORTRAN Ⅲ,1962年推出FORTRAN Ⅳ,開始廣泛被使用。

1966年美国标准化协会制定了Fortran(x3.9-1966,也就是Fortran 66)和Fortran(x3.10-1966)标准。这时Fortran语言还不是结构化的程序设计语言。

1976年美国标准化协会重新对Fortran(x3.9-1966)进行了评估,公布了新的Fortran标准,也就是Fortran 77。Fortran 77是具有结构化特性的编程语言。Fortran77在短时间内取得了巨大的成功,广泛地应用于科学和工程计算,几乎统治了数值计算领域。

1980年,Fortran 77被ISO接纳为国际标准。

1991年发布的Fortran 90大幅改进了旧版Fortran的型式,加入了对象导向的观念与提供指针,并同时加强zh-tw:陣列;zh-cn:数组的功能。

Fortran後來又陸續推出Fortran 95、Fortran 2003等更新版本。

[编辑] FORTRAN

最早的FORTRAN版本應用於IBM 704系統上,包含了32行陳述(statements)如下:

  • DIMENSION and EQUIVALENCE statements
  • 指派(Assignment) statements
  • Three-way arithmetic IF statement. [1]
  • IF 這個陳述式檢查例外情況 (ACCUMULATOR OVERFLOW, QUOTIENT OVERFLOW, and DIVIDE CHECK); and IF statements for manipulating sense switches and sense lights
  • GOTO, computed GOTO, ASSIGN, and assigned GOTO
  • 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: END FILE, REWIND, and BACKSPACE
  • PAUSE, STOP, and CONTINUE
  • FREQUENCY statement (for providing optimization hints to the compiler) [2]

[编辑] FORTRAN II

1958年IBM又推出 FORTRAN II. 支援使用者撰寫副程式(subroutines)以及函數(functions). 有六個新陳述如下:

  • SUBROUTINE, FUNCTION, and END
  • CALL and RETURN
  • COMMON

接下來的幾年內,FORTRAN II 繼續又支援 DOUBLE PRECISIONCOMPLEX 等資料型態(data types)。

[编辑] FORTRAN III

IBM also developed a FORTRAN III in 1958 that allowed for inline assembler code among other features; however, this version was never released as a product. Like the 704 FORTRAN and FORTRAN II, FORTRAN III included machine-dependent features that made code written in it unportable from machine to machine. Early versions of FORTRAN provided by other vendors suffered from the same disadvantage.

A pad of Fortran coding forms, intended to be used by programmers to prepare the program for transcription by card punch operators.  Now obsolete.
A pad of Fortran coding forms, intended to be used by programmers to prepare the program for transcription by card punch operators. Now obsolete.

[编辑] FORTRAN IV

1961年開始,由於客戶的強烈要求,IBM 開始發展FORTRAN IV,目的在於移除一些FORTRAN II 中過於依賴機器本身的程式碼( 例如:READ INPUT TAPE)同時新增一些新的功能,如 LOGICAL 資料型別。布林運算式(TRUE or FALSE)與 logical IF statement 則取代了 arithmetic IF statement. FORTRAN IV 於1962年推出,最早應用於IBM 7030("Stretch")計算機之上,以及其接續的IBM 7090 和 IBM 7094版本。

[编辑] FORTRAN 66

早期的FORTRAN語言發展史上最重要的一件大事也許是美國標準協會American Standards Association,即今日的 ANSI)的委員們開始為FORTRAN制定標準規格,名為"American Standard Fortran." 1966年委員會推出兩套FORTRAN標準版本,分別定義成 FORTRAN (基於FORTRAN IV,用來應付 de facto 標準)和 Basic FORTRAN(基於FORTRAN II,並且移除其平台依賴性)。FORTRAN 第一套標準後來被稱為 FORTRAN 66(大家仍習慣稱之為 FORTRAN IV)。FORTRAN 66 有效的成功第一套工業標準版的FORTRAN。其功能如下:

  • Main program, SUBROUTINE, FUNCTION, and BLOCK DATA program units
  • INTEGER, REAL, DOUBLE PRECISION, COMPLEX, and LOGICAL data types
  • COMMON, DIMENSION, and EQUIVALENCE statements
  • DATA statement for specifying initial values
  • Intrinsic and EXTERNAL (e.g., library) functions
  • Assignment statement
  • GOTO, assigned GOTO, and computed GOTO statements
  • Logical IF and arithmetic (three-way) IF statements
  • DO loops
  • READ, WRITE, BACKSPACE, REWIND, and ENDFILE statements for sequential I/O
  • FORMAT statement
  • CALL, RETURN, PAUSE, and STOP statements
  • Hollerith constants in DATA and FORMAT statements, and as actual arguments to procedures
  • Identifiers of up to six characters in length
  • Comment lines

[编辑] FORTRAN 77

在FORTRAN 66 標準推出之後,各家編譯器廠商不斷推出更具擴充性的標準FOTRAN("Standard Fortran"), 這使得ANSI於1969年開始著手於1966標準版本的修正工作。最後定稿於1977年,1978年四月正式推出FORTRAN。新的標準規格也就是著名的 FORTRAN 77,這個版本是基於FORTRAN 66之上新增許多功能,彌補過去的缺點:

  • CHARACTER data type, with vastly expanded facilities for character input and output and processing of character-based data
  • IMPLICIT statement
  • Block IF statement, with optional ELSE and ELSE IF clauses, to provide improved language support for structured programming
  • OPEN, CLOSE, and INQUIRE statements for improved I/O capability
  • Direct-access file I/O
  • PARAMETER statement for specifying constants
  • SAVE statement for persistent local variables
  • Generic names for intrinsic functions

An important practical extension to FORTRAN 77 was the release of MIL-STD-1753 in 1978. This specification, developed by the U. S. Department of Defense, standardized a number of features implemented by most FORTRAN 77 compilers but not included in the ANSI FORTRAN 77 standard. These features would eventually be incorporated into the Fortran 90 standard.

  • DO WHILE and END DO statements
  • INCLUDE statement
  • IMPLICIT NONE variant of the IMPLICIT statement
  • 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. Over 100 calls were defined in the document - allowing access to POSIX-compatible process control, signal handling, file system control, device control, procedure pointing, and stream I/O in a portable manner.

The development 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 fifteen years, FORTRAN 77 would become the historically most important dialect.

[编辑] FORTRAN的特性

  • Fortran语言的最大特性是接近数学公式的自然描述,在计算机里具有很高的执行效率。
  • 易学,语法严谨。
  • 可以直接对矩阵复数zh-cn:进行运算;zh-tw:平行運算,這點跟Matlab類似。
  • 自诞生以来广泛地应用于数值计算领域,积累了大量高效而可靠的zh-cn:源程序;zh-tw:原始程式
  • 很多专用的大型数值运算计算机针对Fortran做了优化。
  • 广泛地应用于并行计算和zh-cn:高性能計算;zh-tw:高效能運算领域。
  • Fortran 90,Fortran 95,Fortran 2003的相继推出使Fortran语言具备了现代高级编程语言的一些特性。
  • 其矩陣元素在記憶空間儲存順序是採用行優先(Column first),Matlab也承襲這點,目前最多使用的C語言則採用列優先(Row first)。

[编辑] FORTRAN的Hello World程式

下面是一个在标准输出设备上输出Hello World的简单程序,这种程序通常作为开始学习编程语言时的第一个程序:

    WRITE(*,10)
10  FORMAT('Hello, world!')
    STOP
    END

[编辑] FORTRAN编译器

  • Windows操作系统下:
    • Fortran Power Station 4.0 (FPS 4.0),微软公司开发的Fortran编译器。1997年3月转让给DEC公司
    • Digital Visual Fortran (DVF),Fortran Power Station的DEC公司版本。
    • Compaq Visual Fortran (CVF),1998年1月,DEC公司被康柏公司收购,Digital Visual Fortran更名为Compaq Visual Fortran。一个著名的版本是Compaq Visual Fortran 6.5。2002年5月康柏公司已并入惠普公司。Compaq Visual Fortran的最新版是6.6。
    • Intel Fortran,英特尔公司开发的Fortran编译器。
    • Lahey Fortran
    • Absoft Fortran
    • OpenWatcom
  • Linux操作系统下:
    • PGI Fortran
    • G77,GNU的Fortran 77编译器,zh-cn:集成;zh-tw:整合在GCC中。
    • GFORTRAN,GNU的最新的Fortran编译器,集成在GCC 4.0中,目的是支持Fortran 95和一部分Fortran 2003的功能,以替代G77。
    • Intel Fortran
    • Absoft Fortran
    • g95,跟GFORTRAN同为开放源代码的Fortran 95编译器。

[编辑] FORTRAN 的套件

几个著名的Fortran Package:

  • IMSL--国际数学和统计链接库
  • BLAS--Basic Linear Algebra Subroutines
  • LAPACK--Linear Algebra PACKage

[编辑] 注釋

  1. Note: It is commonly believed that this statement corresponded to a three-way branch instruction on the IBM 704. This is not true, the 704 branch instructions all contained only one destination address (e.g., TZE - Transfer AC Zero, TNZ - Transfer AC Not Zero, TPL - Transfer AC Plus, TMI - Transfer AC Minus). The machine (and its successors in the 700/7000 series) did have a three-way skip instruction (CAS - Compare AC with Storage), which was probably the origin of this belief, but using this instruction to implement the IF would consume 4 instruction words, require the constant Zero in a word of storage, and take 3 machine cycles to execute; using the Transfer instructions to implement the IF could be done in 1 to 3 instruction words, required no constants in storage, and take 1 to 3 machine cycles to execute. An optimizing compiler like FORTRAN would most likely select the more compact and usually faster Transfers instead of the Compare (use of Transfers also allowed the FREQUENCY statement to optimize IFs, which could not be done using the Compare). Also the Compare considered -0 and +0 to be different values while the Transfer Zero and Transfer Not Zero considered them to be the same.
  2. The FREQUENCY statement in FORTRAN was used originally and optionally to give branch probabilities for the three branch cases of the Arithmetic IF statement to bias the way code was generated and order of the basic blocks of code generated, in the global optimisation sense, were arranged in memory for optimality. The first FORTRAN compiler used this weighting to do a Monte Carlo simulation of the run-time generated code at compile time. It was very sophisticated for its time. This technique is documented in the original article in 1957 on the first FORTRAN compiler implementation by J. Backus, et al. Many years later, the FREQUENCY statement had no effect on the code, and was treated as a comment statement, since the compilers no longer did this kind of compile-time simulation. Below is a part of the 1957 paper, "The FORTRAN Automatic Coding System" by Backus, et al., with this snippet on the FREQUENCY statement and its use in a compile-time Monte Carlo simulation of the run-time to optimise the code generated. Quoting ...

    The fundamental unit of program is the basic block; a basic block is a stretch of program which has a single entry point and a single exit point. The purpose of section 4 is to prepare for section 5 a table of predecessors (PRED table) which enumerates 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 frequency of each such basic block link. This table is obtained by an actual "execution" of the program in Monte-Carlo fashion, in which the outcome of conditional transfers arising out of IF-type statements and computed GO TO'S is determined by a random number generator suitably weighted according to whatever FREQUENCY statements have been provided.

[编辑] 參見

[编辑] 外部链接

Static Wikipedia (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -

Static Wikipedia 2007 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -

Static Wikipedia 2006 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu

Static Wikipedia February 2008 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu