Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fortran MATTHEW CARSON. History of FORTRAN FORTRAN 0 1954; First High Level Language FORTRAN I 1957; First Compiled Language FORTRAN II1958 1958; Independent.

Similar presentations


Presentation on theme: "Fortran MATTHEW CARSON. History of FORTRAN FORTRAN 0 1954; First High Level Language FORTRAN I 1957; First Compiled Language FORTRAN II1958 1958; Independent."— Presentation transcript:

1 Fortran MATTHEW CARSON

2 History of FORTRAN FORTRAN 0 1954; First High Level Language FORTRAN I 1957; First Compiled Language FORTRAN II1958 1958; Independent Subroutines FORTRAN IV1960 1960; Most Used Version FORTRAN 66 1966-67; First Standard FORTRAN 77 1977-78; IMPLICIT and Block Control Fortran 90 1991-92; Free-form code Fortran 95 1997; FORALL and ALLOCATABLE

3 Fortran Compiler Support for Fortran 2003/2008 http://fortranwiki.org/fortran/show/Fortran+2003+status http://fortranwiki.org/fortran/show/Fortran+2008+status

4 Fortran Overview Variable names up to 31 characters Case-insensitive Strong typed Static binding

5 Data Types INTEGER REAL COMPLEX LOGICAL CHARACTER DERIVED TYPES REAL (KIND=2) :: x = 10.25 REAL (KIND=8) :: x = 10.25 CHARACTER :: char = ‘a’ CHARACTER (LEN=5) :: string = “Hello”

6 Arrays INTEGER, DIMENSION(10, 10) :: array INTEGER, DIMENSION(:, :) :: array CHARACTER, DIMENSION(10) :: array_of_characters CHARACTER(LEN=5), DIMENSION(10) :: array_of_strings

7 Derived Types Fortran 90/95 TYPE car REAL :: weight REAL :: length INTEGER :: id_number END TYPE car Fortran 2003 TYPE circle REAL :: radius CONTAINS PROCEDURE :: area END TYPE circle

8 Operators and Expressions OPERATOR PRECEDENCE 1.Exponentiation (**) 2.Multiplication/Division 3.Addition/Subtraction 4.(, >=, ==, /= ) 5..NOT. 6..AND. 7..OR. 8..XOR.,.EQV.,.NEQV. REAL :: w, x, y, z w = 5 x = 2 y = -w**x! Outputs: -25 z = (-w)**x! Outputs: 25

9 Control Structures IF-ELSE IF-ELSE-END IF SELECT CASE ( ) DO = INITIAL_VAL, END_VAL, STEP DO WHILE ( ) FORALL FORALL (I=1:100, J=1:100) A(I,J)=I*(I+J)

10 Subprograms FUNCTION FUNCTION cube(x) result(y) INTEGER, INTENT(IN) :: x INTEGER :: y y = x**3 END FUNCTION cube PROGRAM test IMPLICIT NONE INTEGER :: cube print *, cube(4) END PROGRAM SUBROUTINE SUBROUTINE half_cube(x, y, z) INTEGER, INTENT(IN) :: x INTEGER, INTENT(OUT) :: y, z y = x/2 z = x**3 END SUBROUTINE half_cube PROGRAM test … CALL half_cube(x, y, z) END PROGRAM

11 Readability Easy to read Free form source code Procedural language base Use of END program statements

12 Writability FORmula TRANslator Inclusion of complex data types Fewer control structures and libraries

13 Reliability Strong typing and Static Binding Simple to read and write = easy to maintain “I don’t know what the language of the year 2000 will look like, but I know it will be called Fortran.” Tony Hoare, Turing award winner 1980

14 Cost Easy to learn Free compiler Backward compatibility


Download ppt "Fortran MATTHEW CARSON. History of FORTRAN FORTRAN 0 1954; First High Level Language FORTRAN I 1957; First Compiled Language FORTRAN II1958 1958; Independent."

Similar presentations


Ads by Google