DrSteveChaos All American 2187 Posts user info edit post |
Looking for a good book on Fortran - 77 and/or 90/95. I'm coming from a C/C++ background, and while I'm solid there, I'd really like to have a text to get up to speed on Fortran conventions/style.
(Yes, I know there's a plethora of stuff on the web; however, I like having a book - it's just how I work.)
What have you got for me, Tech Talk? 4/17/2009 2:12:59 PM |
Jrb599 All American 8846 Posts user info edit post |
I picked up a Fortan 77 book at a used book store for a quarter. You're welcome to it if you want it. 4/17/2009 2:25:58 PM |
sarijoul All American 14208 Posts user info edit post |
i use the older version (fortran 90/95) of this book: http://ecx.images-amazon.com/images/I/51fDCjBjuhL.jpg 4/17/2009 3:00:01 PM |
DrSteveChaos All American 2187 Posts user info edit post |
^ I was actually looking at that one on Amazon - so it's pretty decent, I assume? 4/17/2009 7:52:46 PM |
LimpyNuts All American 16859 Posts user info edit post |
Unless you absolutely must learn FORTRAN, I would run for the hills. All the object-oriented stuff is shitty and fake and neither objects nor oriented.
I used it for years and wrote non-trivial applications with it. C is just as flexible, powerful, portable, and fast as FORTRAN. Without the arbitrary and sometimes serious limitations.
FORTRAN needs to die. 4/17/2009 9:46:42 PM |
DrSteveChaos All American 2187 Posts user info edit post |
I prefer using C. Any given day.
Unfortunately, a lot of codes I'll have to be using are written in Fortran. So it's kind of a necessity of life. 4/17/2009 10:32:22 PM |
Solinari All American 16957 Posts user info edit post |
^^ I thought FORTRAN had the benefit of forcing the programmer to dot his I's and cross his T's... If so, that would definitely be a reason to use FORTRAN over C if it was a mission critical application.
Maybe I'm getting it confused with another old-school language like COBOL though. 4/17/2009 10:54:27 PM |
LimpyNuts All American 16859 Posts user info edit post |
^ I don't know what you're talking about. No code is going to run in any language if you write it wrong. One of the major "strong points" associated with FORTRAN is that the code supposedly looks a lot like the equations it's solving... but the same can be said about any language.
Some people say FORTRAN is good for rapid development. So are Legacy VB, [VB, C#, J#].NET or Java (both slower because they're interpreted languages). Say what you want about VB being a script kiddie language, but the syntax makes it really easy to troubleshoot.
FORTRAN has a lot of built-in functions defined in the spec geared toward engineering applications. That's all well and good, but most compilers don't implement the built-in functions well. A classic example is MATMUL. The f95 implementation is more than 10,000 times slower than the one in g95 or Visual FORTRAN. So you'll end up including a library of engineering functions in FORTRAN just as you would any other language.
FORTRAN was great before C and Basic were available and most programming languages were like MUMPS, JOSS or ALGOL. Attempts to modernize these archaic languages (see Cache ObjectScript and FORTRAN 95/2003) have failed miserably, the only good exception being Pascal (Delphi).
The only reason anyone learns FORTRAN anymore is because of all the dinosaurs out there with a death grip on their FORTRAN sources who never bothered to keep up with modern programming. As a result there's tons of FORTRAN code out there that should have been ported to Pascal or C decades ago and now there are so few people in the world with genuine expertise in FORTRAN that it would be prohibitively difficult to port the source.
As you can tell, I've had nightmarish experiences with FORTRAN and I think it needs to die (along with DCL for OpenVMS ).
]4/18/2009 12:32:14 AM |
sarijoul All American 14208 Posts user info edit post |
as an engineer first and programmer second, fortran works well for my purposes. it's main function is to be able to get the job done and get it done quickly. it's been a while since i've used C extensively, but there is a way to inter-mix C and fortran in a given code with C preprocessors, so I see some of both. I really just think it's personal preference.
as far as things like matmul, etc, unless you're running with NO optimizations, that won't be an issue. 4/18/2009 8:45:15 AM |
LimpyNuts All American 16859 Posts user info edit post |
Either FORTRAN or C can be compiled to a library and called from the other.
Quote : | "as far as things like matmul, etc, unless you're running with NO optimizations, that won't be an issue." |
This is just wishful thinking. If the algorithm the compiler uses for the built-in function is flawed, the optimized algorithm is still flawed. Try it for yourself. While the function definitions are standard, the implementations are not.
Quote : | "I really just think it's personal preference. " |
Not really. What caused you to learn FORTRAN in the first place? I bet it was a requirement for a course, or a class you had to take for your degree program. Someone (or group of people) out there decided for you that you were going to use FORTRAN. i.e. The dinosaurs referenced above.
Of course you're going to continue to `prefer` to use FORTRAN if it's the only language you can hold your own with.4/18/2009 12:33:48 PM |
sarijoul All American 14208 Posts user info edit post |
i mean obviously there is some truth to that. but that by itself doesn't make fortran a bad language for the purposes of crunching numbers. i've seen conflicting reports about what languages are faster for crunching numbers. and for the record, i've never used matmul in any actual research code. (i have a few times in quick codes i've made for classes and such). so i'm not really sure of its performance. 4/18/2009 1:14:46 PM |
Solinari All American 16957 Posts user info edit post |
Quote : | "I don't know what you're talking about. No code is going to run in any language if you write it wrong." |
Wow. You are cruisin for a bruisin... Lots of code will run in many languages even if its written wrong. See Mars Climate Orbiter Probe for an example (not that any language would have protected against that error, but it was still wrongly written code that ran). Unless you're majoring in Tautology and were trying to say that error-free code has no errors.
It might not be Fortran, but I thought there was some language out there (Ada?) that was so strict that it was almost impossible to screw up variable types, pointers, etc.
[Edited on April 18, 2009 at 1:48 PM. Reason : s]4/18/2009 1:45:18 PM |
Wraith All American 27257 Posts user info edit post |
Quote : | "The only reason anyone learns FORTRAN anymore is because of all the dinosaurs out there with a death grip on their FORTRAN sources who never bothered to keep up with modern programming. As a result there's tons of FORTRAN code out there that should have been ported to Pascal or C decades ago and now there are so few people in the world with genuine expertise in FORTRAN that it would be prohibitively difficult to port the source." |
'tis the sad truth. Here at work, everything from the past 50 years was programmed in FORTRAN, even though C has been around for a long time. We are slowly converting over to C and MATLAB though, but it is a complete pain because unless the FORTRAN code was written in the past 5 years or so, there are about 50 goto statements with little to no documentation.4/21/2009 10:16:40 AM |
LimpyNuts All American 16859 Posts user info edit post |
^^No your post I was responding to made no sense. I was talking about invalid syntax. What the fuck else would you mean by "dot his I's and cross his T's". Invalid syntax means it's not going to compile. Tell me what kind of error you're going to make in one language that FORTRAN is going to rescue you from and I'll tell you you're wrong. 4/24/2009 12:11:31 AM |
Charybdisjim All American 5486 Posts user info edit post |
FORTRAN is still used, from what I've heard, because it's one of the easiest ways to write code for relatively simple but massively parrallel tasks. For example, simulating a reactor core as a set of descrete elements defined by the same set of coupled partial differential equations. While we now have many more specialized tools for that, their particular propriatiary languages very strongly resemble FORTRAN and many of them are actually FORTRAN engines.
Also, 2003 onward includes a lot of C interoperability.
As far as performance goes, FORTRAN is disadvantaged by the huge numbers of bizzare defaults for optimizations in most free compilers. With the right optimizations its very efficient.
[Edited on April 24, 2009 at 3:00 AM. Reason : ] 4/24/2009 2:53:44 AM |