Send the link below via email or IMCopy
Present to your audienceStart remote presentation
- Invited audience members will follow you as you navigate and present
- People invited to a presentation do not need a Prezi account
- This link expires 10 minutes after you close the presentation
- A maximum of 30 users can follow your presentation
- Learn more about this feature in our knowledge base article
What is FORTRAN ?
Transcript of What is FORTRAN ?
1st generation language.
Most accepted compiled programming language.
Major contribution is the use of algebraic notation
Stands for IBM Mathematical FORmula TRANslation System but abbreviated to FORmula TRANslation
FORTRAN 0 was developed by a IBM research team headed by John Backus in 1954.
Was the first high-level programming language
History of FORTRAN
The design of FORTRAN made it easier to translate mathematical formulas into code.
FORTRAN originally began as a digital code interpreter for the IBM 701
At that time it was called Speedcoding
The point of FORTRAN was to make programming easier.
FORTRAN I 1957
Was the first compiler
By 1958 over 50% of software was in FORTRAN
Cut development time.
2 weeks to 2 hours
FORTRAN II - IV
Explicit type declarations
Logical selection (IF) statement
Subprogram names could be parameter
ANSI standard in 1966
FORTRAN 77 replaced FORTRAN IV as the new standard.
It retained most of the features of IV
Character string handling
Logical loop control statements
And a If with a optional else statement
FORTRAN 77 explicitly permits data types of integer, real, double precision, complex, logical, and characters.
Real Data Types
Represent decimal numbers
It uses scientific notation
Double Precision Data Types
Extended precision floating point
Instead of E it used D
Complex Data Types
Built in complex number data type
Which occupies 2 bytes
The first byte in the pair represents the real part of the complex data type.
The second byte represents the imaginary part of the complex item
represented as follows
(4.61,-6.81) 4.61 – 6.81i
A FORTRAN program is a collection of subprogram definitions.
Subprograms may be a FUNCTION that returns values, a SUBROUTINE that dosen’t return a value, and one must be the “main program”
The main program receives control of the processor when an executable program is loaded for execution.
There can be only one main program in an executable program.
That main program is identified by the fact that it does not have a FUNCTION, SUBROUTINE, or BLOCK DATA statement as its initial statement.
FORTRAN has many intrinsic functions
SQRT( ) square root
FLOAT( ),INT ( ) type conversions
COS( ),SIN( ), TAN( ) trig functions
Statement functions are one line defined functions that is internal to the program unit in which it is defined
Example of a statement function
ROOT(A,B,C) = (-B+SQRT(B**2-4.0*A*C))/(2.0*A)
STOP and PAUSE statements
The GOTO statement is used to direct program control to indicated by the statement number specified in the respective GOTO statement
Three types of GOTO statements
Unconditional GOTO 100
Assigned GOTO I,(1,2,3)
Contains IF, ELSE IF, ELSE, END IF
ELSE IF (R) THEN
The DO statement is used to establish a controlled loop
DO 10 I = 1,10,1
CONTINUE,STOP PAUSE, and END STATEMENT
The CONTINUE statement serves as a point of reference in a program
No operational function is performed
It is frequently used in DO loops to provide a terminal statement
FORTRAN 77 is not to hard to read on a small scale, but when many GOTO statements are involved it gets very difficult
But FORTRAN 90 is much more easy to read
Identifiers can only be six characters long
Easy file accessing
Recursion and Derived data types
Compile-time initialization of local variables
Separate pointer assignment operator (good and bad)
Is not very reliable
Only static type checking
Lack of exception handling
Lots of free resources/compilers
A fairly easy language to learn
FORTRAN 90 AND 95
FORTRAN 90 (ANSI standard in 1990)
Object base programing
FORTRAN violates several programming principles
The only reasonable numbers in a programming language design are zero, one and infinity. A special case of the regularity principle.
Defense in depth Principle
If an error gets through one line of defense then it should be caught by the next line of defense.
Language rules should be applied universally without exception.
Structured Programming Principle
The static structure of a program should correspond in a simple way to the dynamic structure of the program.
Syntactic consistency principle
Things which look similar should be similar, and things which look different should be different.
Fortran 77 arbitrarily limits identifier names to 6 characters.
Fortran 77 arbitrarily limits arrays to 3 dimensions.
FORTRAN does not have exception handling or type chcking.
If mistakenly put . instead of ,
FORTRAN take is as a valid automation variable declaration
FORTRAN - Can store strings in integers
Perimits Hollerith constants to be used as parameters.
GOTO statements are required in Fortran 77 to emulate while loops, and there are three similar looking versions of the GOTO statement with different behavior.
The simple, computed , and assigned goto statements in Fortran are different but look similar.
GOTO N - Basic GOTO
GOTO (L1, L2,...., LN)E - Computed GOTO
GOTO L,(L1,L2,...., LN) - Assign GOTO
Assign 20 to L
Fortran uses :
* for multiplication and ** for exponents
= for assignment and == for equal
+ for addition and ++ for increment
What is the difference between a Subprogram and a Subroutine ?
A subroutine is one type of a subprogram. A Function is another, and a BLOCKDATA routine is a third.
What are the Five Arithmetic Operators of FORTRAN?
+, -, *, /, **
What are the six relational operators in FORTRAN?
.LT., .LE., .GT., .EQ., .NE.
What is the first line of every FORTRAN program and what does it tell the compiler?
Rewrite this code to use the DO WHILE statement:
SUM = SUM + I
I = N
DO WHILE (I .GT. N)
SUM = SUM + I
I = I - 1
Write a function that will take a number and return a number that is the original
number taken to a given exponent.
REAL FUNCTION POW(NUM, EXPO)
POW = NUM ** EXPO
Fix the bugs
Was developed, but it was never widely distributed
FORTRAN 95 (latest ANSI standard version)
FORTRAN 90/95 allows user defined types.
The END statement marks the physical end of a program
The STOP and PAUSE statements do a similar task
The STOP terminates execution
The PAUSE terminates execution, but leaves the program in a resumable state
A programming language construct should be limited to being singular, zero or able to scale to infinitely.
There should exist multiple checks for errors in a program such that error detection is maximized.
There should not exist any exceptions to grammar rules.
The execution of a program should be easy to trace given its source code.
The language should have visually different constructs to avoid confusion between similar symbols for constructs.