Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To be a language focused on mathematics and scientific computing, I am always baffled by the total lack of useful mathematical routines in the Fortran standard library. One would expect it to be shipped at least with a routine to compute standard deviation and mean, but this is not the case. In particular with the introduction of Fortran 90 and the addition of modules (thus reducing namespace pollution), I don't see any reason why of this critical lack of services.

I would like to hear your knowledge about why this is the case.

share|improve this question
Its been 20 years since I used fortran and in those days I did not pay as much attention to what the standards said I just used what happened to be on the machines. I found that the amount of mathematical libraries that were available were huge and consistent across the machines I used. I am wondering if this is because though the libraries are not standard are they ubiquitous? (I have no idea that is a question). – Loki Astari Feb 1 '11 at 11:35
up vote 17 down vote accepted

Back when FORTRAN was developed, there was no such thing as portability of code. It was absolutely routine for the FORTRAN compiler on one machine to accept a slightly different language that the compiler on another machine. The most common variation was name length. The IBM 1130 FORTRAN allowed five characters, the DEC-10 allowed six, the CDC 6600 (my first machine, my first real assembly language) allowed seven. Three-dimensional arrays were required by the language; at least one minicomputer (Varian 76?) FORTRAN allowed seven-dimensional arrays.

Companies routinely extended their FORTRAN languages, to make their machines more appealing to customers, and, while the extensions might provide similar functionality, they were never identical. Lots of compilers provided extensions for doing file I/O and overlay management, and they were never identical. Sometimes they weren't even close.

FORTRAN-to-FORTRAN conversions, porting a program from one machine to another, was a very busy cottage industry, and the guys who could do it could always find work. (I worked two such conversions: I helped port the original Matuszek-Reynolds-McGehearty-Cohen "Star Trek" game from the CDC 6600 to the DEC-10, and I ported an EKG analysis program from Varian 76 to TI 990. No two such projects were identical.)

This kind of thing made it very, very difficult to provide "standard" libraries, although a few people tried. The IMSL library was the biggest, but it was shipped in source code form, and the customer was required to get it working on his system.

Also: FORTRAN programmers were expected to have a reasonable background in numerical methods. Just about every FORTRAN programmer on the planet in those days learned how to do mean and standard deviation for himself, as a homework assignment. Every FORTRAN programmer learned bisection and Newton-Raphson iteration (nowadays called "Newton's Method") in school. Runge-Kutta methods were taught, usually by rote, and, at that time, 6th-order Runge-Kutta integrators were textbook examples. (It was much later that people figured out that 4th order Runge-Kutta was the "sweet spot" on the cost-effectiveness curve.)

And: Programmers RARELY changed computers without also changing jobs. Those programmers who did move around were expected AND REQUIRED to be very good at learning how the new systems worked, and picking up the differences.

In that environment, there's going to be very little call for a "standard" STDDEV code, when it was something that any competent entry-level FORTRAN programmer could write in his sleep.

share|improve this answer
> Also: FORTRAN programmers were expected to have a reasonable background in numerical methods -- as opposed to today when it seems programmers first skill is to learn how to use google :-) – Anders K. Feb 1 '11 at 14:12
Everybody used NAG anyway – Martin Beckett Mar 9 '11 at 2:46
@MartinBeckett: This was long before NAG. – John R. Strohm Apr 10 '13 at 16:15
@Rook, I am afraid you are destined to be horribly disappointed. – John R. Strohm Feb 6 '15 at 18:03
@Rook I definitely can do them, but I have no idea I'd do them in an efficient and numerically stable way on the first try. – Ixrec Apr 7 '15 at 22:36

Personally I think this fact due to MKL library. If you're looking for a high-performance math library, then MKL is what you need. It's not that expensive, and a laboratory that performs math computing in its projects can afford it.

share|improve this answer
would you mind explaining about this in more detail - how and why does it answer the question asked? "Link-only answers" are not quite welcome at Stack Exchange – gnat Sep 2 '13 at 7:43

cernlib did a lot of what you ask for for people working in high-energy physics and it is still useful.

share|improve this answer

BLAS and LAPACK are de-facto standard Fortran libraries.

share|improve this answer

The FORmulaTRANslation language was designed to make it easy for you to write your own formulas. Why should Fortran define a mean function when you can write in Fortran 90 onwards

xmean = sum(x)/max(size(x),1) ?

share|improve this answer
You are assuming that the array x is full of values. This is usually a very bad assumption to make. – John R. Strohm Feb 15 '11 at 17:28

protected by gnat Apr 7 '15 at 22:20

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.