Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fortran - A Language with a Past and a Future Peter Crouch Chairman BCS Fortran Specialist Group BCS Wolverhampton.

Similar presentations


Presentation on theme: "Fortran - A Language with a Past and a Future Peter Crouch Chairman BCS Fortran Specialist Group BCS Wolverhampton."— Presentation transcript:

1 Fortran - A Language with a Past and a Future Peter Crouch pccrouch@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 - 1984Industrial 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 - 2001Software developer for Computer Aided Design and Manufacturing systems using Fortran and C. 2003 - 2005Civil servant in the Department for Work and Pensions. 1993I joined the British Computer Society 1997 - 2002I was Chairman of the BCS Birmingham Branch 2002 - 2005I 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. 1954John Backus and his team at IBM began work on what became the first high level programming language, FORTRAN. 1957First 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 1958FORTRAN II 1958FORTRAN III - Not released to public 1961FORTRAN IV - A "cleaned up" version of FORTRAN II 1962First ASA FORTRAN standardization committee meets

7 Fortran Standards Revision History 1962First ASA (later ANSI) standardization committee meets 1966Publication of ANSI standard X3.9-1966ANSI standard X3.9-1966 (FORTRAN 66) - first programming language standard 1978Publication of ANSI X3.9-1978ANSI X3.9-1978 (FORTRAN 77) - also published as ISO 1539:1980 – relatively minor revision 1991ISO/IEC 1539:1991 (Fortran 90) - major revision 1997ISO/IEC 1539-1:1997 (Fortran 95) - minor revision 2004ISO/IEC 1539-1:2004 (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 DIMENSION A(11) READ A 2 DO 3,8,11 J=1,11 3 I=11-J Y=SQRT(ABS(A(I+1)))+5*A(I+1)**3 IF (400>=Y) 8,4 4 PRINT I,999. GOTO 2 8 PRINT I,Y 11 STOP Example code - FORTRAN 0

10 C THE TPK ALGORITHM C FORTRAN I STYLE FUNF(T)=SQRTF(ABSF(T))+5.0*T**3 DIMENSION A(11) 1 FORMAT(6F12.4) READ 1,A DO 10 J=1,11 I=11-J Y=FUNF(A(I+1)) 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 Example code - FORTRAN I

11 C THE TPK ALGORITHM C FORTRAN IV STYLE DIMENSION A(11) FUN(T) = SQRT(ABS(T)) + 5.)*T**3 READ (5,1) A 1 FORMAT(5F10.2) DO 10 J = 1, 11 I = 11 - J Y = FUN(A(I+1)) 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 Example code - FORTRAN IV or 66

12 PROGRAM TPK C THE TPK ALGORITHM C FORTRAN 77 STYLE REAL A(0:10) 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 FUN = SQRT(ABS(T)) + 5.0*T**3 END Example code - FORTRAN 77

13 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 Modern Developments

14 PROGRAM TPK ! The TPK Algorithm ! Fortran 90 style IMPLICIT NONE INTEGER :: I REAL :: Y REAL, DIMENSION(0:10) :: A READ (*,*) A DO I = 10, 0, -1 ! Backwards Y = FUN(A(I)) IF ( Y < 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.0*T**3 END FUNCTION FUN END PROGRAM TPK Example code - Fortran 90 & 95

15 module Functions public :: fun contains function fun(t) result (r) real, intent(in) :: t real :: r r = sqrt(abs(t)) + 5.0*t**3 end function fun end module Functions Example code - F (1)

16 program TPK ! The TPK Algorithm ! F style use Functions integer :: i real :: y real, dimension(0:10) :: a read *, a do i = 10, 0, -1 ! Backwards y = fun(a(i)) if ( y < 400.0 ) then print *, i, y else print *, i, " Too large" end if end do end program TPK Example code - F (2)

17 International Standard, ISO/IEC 1539-1:2004, 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) Fortran 2003

18 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 ActivitiesFortran Standardisation Activities - FSG web site BCS Fortran Specialist Group

19 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 UK’s 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.” Fortran SG continued

20 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 Application Areas for Fortran programs

21 Thank you, any questions? www.fortran.bcs.org


Download ppt "Fortran - A Language with a Past and a Future Peter Crouch Chairman BCS Fortran Specialist Group BCS Wolverhampton."

Similar presentations


Ads by Google