FORTRAN
Christopher Harmon
28 December 2018 ·
Sorry if this is a noob question, I know that FORTRAN II and IV were popular a widely used, but was there FORTRAN III (or was it more or less a 'beta' that evolved into IV)?
55
23 comments
Michael A. Covington
I think the latter. I never encountered it. Wikipedia's article about FORTRAN should say.
Michael A. Covington
FORTRAN III was developed by IBM for one particular machine architecture and was not released as a product because it was not going to be portable (according to Wikipedia).
1
John Johnson
FORTRAN V (somewhat CDC specific) at uni, replaced by my second year with MNF (Minnesota FORTRAN, also CDC specific).
FORTRAN 77 endures.
1
Richard Sexton
Probably. Fortran two was dumber than a hammer.
if (simple expression) lt, eq, gt
ws all you had. one expression and three line numbers where to go if it was negative, zero or positive. It was horrid.
Fortran IV (which didn't run on a lot of computers that could run fortran II because it was a pig on core) had logical ifs:
if (x .gt. 0.4 .and. y .eq. 9) lt, eq, gt.
Warfor replaces Foran IV, then Watfiv replaced that, Watfiv-S is structured Watfiv and acts like C.
Fortran 77 is mil spec so they have a fixed reference point. Cruise missile software is written in Fortran 77. You'd use Watfiv-S these days if you were trying to do something.
Fortra has one great advantage over any other language: it loves matrices. You wouldn't want to invert a matrix in any other language so supercomputers see a lot of it. These will spend half the time on a N hour run just computring what matrix multiplication method to use (sparse and dense are different) then will actually do it. Without the first step it's 10X longer. God help you if you had to do this in C).
2
Michael A. Covington
Why is matrix multiplication easier in Fortran than in, say, C?
Richard Gowan
I remember hearing about this in a numerical analysis class (math). It was something about the order of operations re locations in memory I think, for arrays as defined in the standard ways per the language spec. I wish I could recall more detail. Does anybody know for sure?
Adam Michlin
I'm only guessing, but C uses what are called arrays of arrays (or jagged arrays) and Fortran had/has true multidimensional arrays. So it would make sense that multiplication of a matrix (multidimensional array) by a scalar would be built in to Fortran and not C.
But I've never written a line of Fortran in my life, so I'm quite possibly wrong.
1
Michael A. Covington
C has multidimensional arrays too, doesn't it?
Nick Holland
You can basically do anything you want in C, but C was written for system programmers and people building applications, not scientists and mathematicians trying to solve a particular problem. To make C do some of these things will require external libraries which are built in to FORTRAN, and it won't be as straight forward as it is in FORTRAN.
In FORTRAN II's defense -- it ran on really small systems, systems that probably couldn't run a modern "hello world" program today. Yes, the conditional was primitive, but then, so was the processor it was running on.
1
Vince Otten
Richard Sexton: would you say FORTRAN’s “love” of “matrices” makes it superior to APL?
Richard Sexton
Michael A. Covington The way it handles arrays. This has been written about quite a bit.
Here's a quickie explanation from stackoverflow which I think sums it up pretty well.
Language designers face many choices. Ken Kennedy emphasized two: (1) better abstractions and (2) higher- or lower-level (less or more machine-like) code. While functional languages like Haskell and Scheme focus on the former, traditional scientific-computing languages like Fortran and C/C++ focused on the latter. Saying that one language is faster than another is usually quite misleading: each language has a problem domain for which it excels. Fortran fares better in the domain of array-based numerical codes than other languages for two basic reasons: its array model and its explicitness.
Array Model
Fortran programmers largely do array manipulations. For that, Fortran facilitates several compiler optimizations that are not available in other languages. The best example is vectorization: knowing the data layout enables the compiler to invoke assembly-level intrinsics over the array.
Language Explicitness
While it seems that a simpler language should compile "better" than a more complex one, that really isn't the case. When one writes in an assembly language, there isn't much a compiler can do: all it sees are very-fine-grained instructions. Fortran requires explicitness (thus, more work by the programmer) only in cases that yield real rewards for array-based computing. Fortran uses simple data types, basic control flow, and limited namespaces; by contrast, it does not tell the computer how to load registers (which might be necessary for real-time). Where Fortran is explicit, it enables things like complete type inference, which helps novices to get started. It also avoids one thing that often makes C slow: opaque pointers.
Fortran Can Be Slow
Fortran is not fast for every task: that's why not many people use it for building GUIs or even for highly unstructured scientific computing. Once you leave the world of arrays for graphs, decision trees, and other realms, this speed advantage quickly goes away. See the computer language benchmarks for some examples and numbers.
Lawrence Hughes
At FSU (CDC Cybers) we had FORTRAN (FORTRAN IV) and FTN (FORTRAN Extended) - never saw a version number for that. FTN had a number of nice extensions beyond vanilla FORTRAN. I must have written over 100K lines of FORTRAN. I often made my own extensions… See more
Michael A. Covington
I did much the same at the U of Georgia. Fortran Extended was CDC's own set of extensions to FORTRAN IV. There was a time when their FORTRAN IV compiler was named simply RUN.
Lawrence Hughes
Michael A. Covington You are right - the name of the FORTRAN IV compiler was just "RUN" followed by an "LGO" (Load of the object file created by the compiler, and GO). Followed by a 789 card then the FORTRAN deck, then another 789 and data cards, then a 6789 card.
1
Michael A. Covington
The notion of 2 different strengths if end of file mark is a CDC distinctive.
Lawrence Hughes
Michael A. Covington Actually 789 was EOR (End of Record). 6789 was EOF. Many things in CDC had records within files.
Michael A. Covington
Lawrence Hughes Yes; I was describing them conceptually. I have never encountered that on any other computer.
Michael A. Covington
The other strange thing was the lack of a newline character in text files. Instead, a specific positioning of what would otherwise be two colons.
Lawrence Hughes
Michael A. Covington That doesn't ring a bell - seems like EOL was a null character (0x00). It might have appeared as two colons in some editors. There was also a way to do lower case with six bit bytes - using 74 and 76 (octal) escape characters. I wrote a lot of code that allowed printing mixed case on our electrostatic plotter. Quite a challenge on CDC. Whole lot easier on machines with 8 bit bytes and ASCII.
Lawrence Hughes
FORTRAN 77 while nice was kind of late to the party. By then other better languages were starting to happen.
Lawrence Hughes
One nice thing about almost all FORTRANs is that it was compiled, and highly modular. Not interpreted like BASIC, Java or Python, and not monolithic like PASCAL (finally kind of fixed by Modula2).
Robert Schuldenfrei
The original BASIC at Dartmouth was compiled.
Mark Graybill
FORTRAN III was strangled in the cradle. It was a significant advancement over FORTRAN II, but included many machine dependent features. Since machine independence had become the flavor of the day, it was unreleased aside from some decks to testers, then suppressed in favor of the machine independent FORTRAN IV. Backus tells the tale in one of his papers. Let's see if I can find a non-paywalled copy...
Here we go:
http://www.softwarepreservation.org/.../p165-backus.pdf
1
Like