Fortran - A Language with a Past and a Future PowerPoint PPT Presentation

presentation player overlay
About This Presentation
Transcript and Presenter's Notes

Title: Fortran - A Language with a Past and a Future


1
  • Fortran - A Language with a Past and a Future
  • Peter Crouch
  • pccrouch_at_bcs.org.uk
  • Chairman
  • BCS Fortran Specialist Group
  • www.fortran.bcs.org
  • BCS Wolverhampton Branch meeting 16th March 2005

2
A Brief Career History
1968 - 1984 Industrial research chemist. I
started programming early personal computers in
BASIC and Pascal in the late 1970s. I began to
to use FORTRAN in the early 1980s. 1985 -
2001 Software developer for Computer Aided Design
and Manufacturing systems using Fortran and
C. 2003 - 2005 Civil servant in the Department
for Work and Pensions. 1993 I joined the
British Computer Society 1997 - 2002 I was
Chairman of the BCS Birmingham Branch 2002 -
2005 I am Chairman of the BCS Fortran Specialist
Group
3
Presentation Outline
  • The Ancient History of FORTRAN - 1954 to 1980
  • Modern Developments in Fortran - 1990 to 2004
  • The BCS Fortran Specialist Group - 1970 to 2005
  • Application Areas for Fortran programs

4
Computing in the early 1950s
Computer memories of the order of 15 KB, often
measured in bits. CPU programmed using octal
code, later machine code and assembler. 1954 John
Backus and his team at IBM began work on what
became the first high level programming
language, FORTRAN. 1957 First version of FORTRAN,
for the IBM 704, released. It was an immediate
success.
5
Ancient History Links
Pioneers of the 'Fortran' Programming
Language New York Times Steve Lohr June 13,
2001 (HTML) Fortran Automated Coding System For
the IBM 704 John Backus, et al. Oct. 1956 The
very first Fortran manual (PDF)
6
The Next Steps
1958 FORTRAN II 1958 FORTRAN III - Not released
to public 1961 FORTRAN IV - A "cleaned up"
version of FORTRAN II 1962 First ASA FORTRAN
standardization committee meets
7
Fortran StandardsRevision History
1962 First ASA (later ANSI) standardization
committee meets 1966 Publication of ANSI
standard X3.9-1966 (FORTRAN 66) - first
programming language standard 1978 Publication
of ANSI X3.9-1978 (FORTRAN 77) - also
published as ISO 15391980 relatively minor
revision 1991 ISO/IEC 15391991 (Fortran 90) -
major revision 1997 ISO/IEC 1539-11997 (Fortran
95) - minor revision 2004 ISO/IEC 1539-12004
(Fortran 2003) - major revision
8
What FORTRAN 77 did for us
  • FORTRAN 77 added
  • DO loops with a decreasing control variable
    (index)
  • Block if statements IF ... THEN ... ELSE ...
    ENDIF. Before F77 there were only IF ... GOTO
    statements
  • Pre-test of DO loops. Before F77 DO loops were
    always executed at least once, so you had to add
    an IF ... GOTO before the loop if you wanted the
    expected behaviour.
  • CHARACTER data type. Before F77 characters were
    always stored inside INTEGER variables.
  • Apostrophe delimited character string constants.
  • Main program termination without a STOP statement.

9
Example code - FORTRAN 0
DIMENSION A(11) READ A 2
DO 3,8,11 J1,11 3 I11-J
YSQRT(ABS(A(I1)))5A(I1)3 IF
(400gtY) 8,4 4 PRINT I,999.
GOTO 2 8 PRINT I,Y 11 STOP
10
Example code - FORTRAN I
C THE TPK ALGORITHM C FORTRAN I
STYLE FUNF(T)SQRTF(ABSF(T))5.0T3
DIMENSION A(11) 1
FORMAT(6F12.4) READ 1,A
DO 10 J1,11 I11-J
YFUNF(A(I1)) IF(400.0-Y)4,8,8
4 PRINT 5,I 5 FORMAT(I10,10H TOO
LARGE) GOTO 10 8 PRINT
9,I,Y 9 FORMAT(I10,F12.7) 10
CONTINUE STOP 52525
11
Example code - FORTRAN IV or 66
  • C THE TPK ALGORITHM
  • C FORTRAN IV STYLE
  • DIMENSION A(11)
  • FUN(T) SQRT(ABS(T)) 5.)T3
  • READ (5,1) A
  • 1 FORMAT(5F10.2)
  • DO 10 J 1, 11
  • I 11 - J
  • Y FUN(A(I1))
  • IF (400.0-Y) 4, 8, 8
  • 4 WRITE (6,5) I
  • 5 FORMAT(I10, 10H TOO LARGE)
  • GO TO 10
  • 8 WRITE(6,9) I, Y
  • FORMAT(I10, F12.6)
  • 10 CONTINUE
  • STOP
  • END

12
Example code - FORTRAN 77
  • PROGRAM TPK
  • C THE TPK ALGORITHM
  • C FORTRAN 77 STYLE
  • REAL A(010)
  • READ (5,) A
  • DO 10 I 10, 0, -1
  • Y FUN(A(I))
  • IF (Y .LT. 400) THEN
  • WRITE(6,9) I,Y
  • 9 FORMAT(I10. F12.6)
  • ELSE
  • WRITE (6,5) I
  • 5 FORMAT(I10,' TOO LARGE')
  • ENDIF
  • 10 CONTINUE
  • END
  • REAL FUNCTION FUN(T)
  • REAL T

13
Modern Developments
  • Fortran 90 added
  • Free format source code form (column
    independent)
  • Modern control structures (CASE DO WHILE)
  • Records/structures - called "Derived Data
    Types"
  • Powerful array notation (array sections, array
    operators, etc.)
  • Dynamic memory allocation
  • Operator overloading
  • Keyword argument passing
  • The INTENT (in, out, inout) procedure argument
    attribute
  • Control of numeric precision and range
  • Modules - packages containing variable and code

14
Example code - Fortran 90 95
PROGRAM TPK ! The TPK Algorithm ! Fortran 90
style IMPLICIT NONE INTEGER
I REAL Y REAL,
DIMENSION(010) A READ (,) A DO I
10, 0, -1 ! Backwards Y FUN(A(I))
IF ( Y lt 400.0 ) THEN WRITE(,) I, Y
ELSE WRITE(,) I, ' Too large' END IF
END DO CONTAINS ! Local
function FUNCTION FUN(T) REAL FUN
REAL, INTENT(IN) T FUN
SQRT(ABS(T)) 5.0T3 END FUNCTION FUN
END PROGRAM TPK
15
Example code - F (1)
module Functions public fun
contains function fun(t) result (r)
real, intent(in) t real
r r sqrt(abs(t)) 5.0t3
end function fun end module Functions
16
Example code - F (2)
program TPK ! The TPK Algorithm ! F
style use Functions integer
i real y real,
dimension(010) a read , a do i
10, 0, -1 ! Backwards y
fun(a(i)) if ( y lt 400.0 ) then
print , i, y else print
, i, " Too large" end if end do
end program TPK
17
Fortran 2003
  • International Standard, ISO/IEC 1539-12004,
    published in November 2004
  • Fortran 2003 notably added
  • Support for object orientated programming
  • Interoperability with C
  • Overview of new features in Fortran 2003
  • by John Reid
  • Convenor, ISO Fortran Working Group
  • (PDF)

18
BCS Fortran Specialist Group
  • The Group was founded in 1970 with the objectives
    of
  • forming a focus in the United Kingdom for work
    concerned with establishing and maintaining
    FORTRAN standards.
  • working in association with national
    and international standardisation bodies
  • The convenor (chairman) of the ISO WG5 committee
    responsible for the Fortran language is a member
    of the FSG committee as is the convenor of the
    BSI (UK) Fortran panel.
  • For the last few years the Fortran SG has
    provided financial support to enable several UK
    representatives to attend ISO meetings abroad.
  • Fortran Standardisation Activities - FSG web site

19
Fortran SG continued
In October 2002 the Group held a meeting to
discuss some of the remaining features to go into
Fortran 2003. Of the seven proposals put forward
five were taken forward to the BSI Fortran
Panel. At the next WG5 meeting, where three of
the five UK representatives were funded by the
BCS through the FSG, ten of the eleven UK
proposed technical changes were accepted, as were
thirteen of the UKs fifteen minor technical
changes and seventeen of the twenty-two minor
edits put forward by the UK. One could argue
that the BCS funds were well invested.
20
Application Areas for Fortran programs
  • Fortran users include the UK Meteorological
    Office, the Ministry of Defence, the Atomic
    Weapons Establishment, oil companies, the
    aircraft and automobile industries, engineering
    consultancies, universities, research
    laboratories and other scientific institutions.
    It is also used in the finance industry, which
    does complex calculations to analyse stock market
    and financial market data.
  • Examples from FSG presentations

21

Thank you, any questions? www.fortran.bcs.org
Write a Comment
User Comments (0)
About PowerShow.com