Sherman Crank Up The WayBack Machine
If you don't get the title, you're probably too young to get the rest of this. If you don't know who John Backus was or what his contribution to computer science was then you're also, probably, too young.
The first programming I ever did was in a language called DITRAN using punched cards. DITRAN was a Diagnostic version of FORTRAN. I found it about as interesting as watching the corn grow.
Some years later, sitting in front of a CRT, it was a completely different story, I was hooked. We were developing accounting applications in FORTRAN 66 (you read that right) on a Prime 300 mini-computer. Prime had a BASIC interpreter, but that was for wimps.
So, today I wondered if I could compile and run a FORTRAN program on Linux. First problem I had, was I couldn't remember enough FORTRAN to actually write a program, so I stole this from the Wikipedia FORTRAN page. Had to make a few slight modifications to get it to compile:
C AREA OF A TRIANGLE WITH A STANDARD SQUARE ROOT FUNCTION
C INPUT - CARD READER UNIT 5, INTEGER INPUT
C OUTPUT - LINE PRINTER UNIT 6, REAL OUTPUT
C INPUT ERROR DISPLAY ERROR OUTPUT CODE 1 IN JOB CONTROL LISTING
READ 501, IA, IB, IC
501 FORMAT (3I5)
C IA, IB, AND IC MAY NOT BE NEGATIVE
C FURTHERMORE, THE SUM OF TWO SIDES OF A TRIANGLE
C IS GREATER THAN THE THIRD SIDE, SO WE CHECK FOR THAT, TOO
IF (IA) 777, 777, 701
701 IF (IB) 777, 777, 702
702 IF (IC) 777, 777, 703
703 IF (IA+IB-IC) 777,777,704
704 IF (IA+IC-IB) 777,777,705
705 IF (IB+IC-IA) 777,777,799
777 STOP 1
C USING HERON'S FORMULA WE CALCULATE THE
C AREA OF THE TRIANGLE
799 S = FLOAT (IA + IB + IC) / 2.0
AREA = SQRT( S * (S - FLOAT(IA)) * (S - FLOAT(IB)) *
+ (S - FLOAT(IC)))
WRITE (0,601) IA, IB, IC, AREA
601 FORMAT (4H A= ,I5,5H B= ,I5,5H C= ,I5,8H AREA= ,F10.2,
+ 13H SQUARE UNITS)
STOP
END
$ gfortran test.fRunning it is simple, although it took me a while to remember that FORTRAN likes its input values separated by commas:
$ ./a.out 3,4,5 A= 3 B= 4 C= 5 AREA= 6.00 SQUARE UNITSAlso took me a while to figure out some acceptable input values... can you say trigonometry?.
If none of this is new to you, if it seems quite old-hat, then maybe you're involved in some sort of HPC (High Performance Computing). If so, check this link and maybe you can pass along some of that knowledge to some of these youngsters.
Mitch Frazier is an Associate Editor for Linux Journal.
Trending Topics
| You Need A Budget | Feb 10, 2012 |
| The Linux powered LAN Gaming House | Feb 08, 2012 |
| Creating a vDSO: the Colonel's Other Chicken | Feb 06, 2012 |
| Your CMS Is Not Your Web Site | Feb 01, 2012 |
| Casper, the Friendly (and Persistent) Ghost | Jan 31, 2012 |
| Razor-qt 0.4 - Qt based Desktop Environment | Jan 30, 2012 |
- Fun with ethtool
- Parallel Programming with NVIDIA CUDA
- Readers' Choice Awards 2011
- 100% disappointed with the decision to go all digital.
- Linux-Based X Terminals with XDMCP
- Validate an E-Mail Address with PHP, the Right Way
- You Need A Budget
- The Linux powered LAN Gaming House
- Why Python?
- Python for Android
- Employment Posters
3 hours 6 min ago - Sure the best distro is
4 hours 26 min ago - BeOS was the best
7 hours 10 min ago - I use Wireshark on a daily
11 hours 40 min ago - buena información
16 hours 47 min ago - One important "bucket" that I didn't note (désolé si qqun deja d
17 hours 48 min ago - Gnome3 is such a POS. No one
1 day 3 hours ago - Gnome 3 is the biggest POS
1 day 3 hours ago - I didn't knew this thing by
1 day 9 hours ago - Author's reply
1 day 12 hours ago





Comments
MSN VISTA
MSN VISTA
Fortran aesthetics
That's a semi-fancy Fortran code you found, it's even got indenting! The stuff floating around here is unindented and written in all caps, which contribute to making it nigh unreadable. I suspect the all caps frequency may be because they actually didn't have lowercase back then.
Nowadays, you can actually write quasi-readable Fortran in lowercase (which is provably more readable than all-uppercase) with indentation.
FORTRAN acronym
FORTRAN originally stood for FORmula TRANslation, according to my memory. This one of the first special purpose languages, along with COmmon Business Oriented Language (for business uses). FORTRAN was designed mainly for running scientific formula programs. The data would be on a (Hollerith) punch card(s) following the EOR card (End Of Record) and prior to the EOF (End Of File) card.
By the way, the EOR and EOF formats for data/program were also used for teletype transmittal.
Fortran 66
When I was learning it, it wasn't _called_ Fortran 66, it was Fortran IV. I think the name Fortran 66 was applied retrospectively when Fortran 77 came out. Oh, yeah, and it should really be spelled in caps: FORTRAN. Don't ask me why - ask Mr. Peabody!
No and Yes
No, according to Wikipedia (the source of all knowledge), the official name was FORTRAN 66:
And yes, it is supposed to be all uppercase and as far as I see that's what I put. According to Mr. Peabody the reason for this is that it predates the evolution of the science of Acronyms. Kind of a goofy explanation, but whaddya expect from a dog with glasses.
Mitch Frazier is an Associate Editor for Linux Journal.