-----BEGIN PGP SIGNED MESSAGE----- In article <011801c249f6$61f71380$2c4432d2@nosedog>, Gavin Sinclair <gsinclair / soyabean.com.au> wrote: > >----- Original Message ----- >From: "Dan Sugalski" <dan / sidhe.org> > > >> >> Folks have already thrown Lisp, OCaml, Prolog, and Japanese into the >> mix, and Smalltalk is always floating around. Given that those are >> reasonably academic languages (Okay, except for Japanese :) I'll add >> a few of the more low-level or odd languages. >> >> [...] >> >> Fortran: Yeah, it's older than you are, but it still can't be beat for speed. > >Can I ask why? People say it all the time, but I point-blank refuse to believe >that it is faster than optimised C. They're the same bloody thing, aren't >they? - low-level procedural languages. - - No. C is much more complicated that Fortran ( at least Fortran77.) There are no pointers in Fortran77[1]. There are no data structures more complicated than an array in Fortran. > My knowledge of Fortran is small, but >of course everyone knows it's used for scientific calculations, so it may have >the edge in numerical calculations (infinite precision, ...) - - Infinite precision, Fortran.... That's really funny. What you get in Fortran is well tested, proven numerical libraries. Writing numerical code that gets correct answers is not always easy. Many C numerical libraries are just plain broken. > but can't you get >a C library that equals it? If not, why not. It's all machine language in the >end, and not sufficiently far from that to begin with for me to believe that >the two should be any different. > - - In theory yes, in practice the Fortran code has the following advantages. a. The algorithms and libraries have been proven and optimized by years of use. b. BLAS assembler routines. c. Vector compilers have a much easier time getting performance out of Fortran code. It's pretty easy to write code in C that can't be vectorized well. Of course you can write Fortran in any language, if you write fortran-like C the compiler will vectorize fairly well. Many of the early supercomputers were explictly designed in the hardware to run Fortran for loops as fast as humanly possible. When you design the hardware to the language, it's hard to match performance in other languages. - - The best of all worlds is to call the Fortran code libraries from a programming language that's a lot friendlier. I used to write a lot of code that did the data management in C and all the numerical heavy lifting in Fortran. - - Booker C. Bense [1]- Of course the first thing every complicated program does is implement pointers using a whopping big common block and array indices. -----BEGIN PGP SIGNATURE----- Version: 2.6.2 iQCVAwUBPWUmxGTWTAjn5N/lAQHLRwP9HLynKTE6RxU1CHwGjxyEpivnwpSyTAJy d7z3D17BIH0rN3TKw8usJ/0k5gKmO6kfo8yS6OuX+pcX1R/hKAESZTkUaTTooLEr YGiKgjhMmLItTDsS00ZGlQ/X6o2rO7ZhdKrFQrOJyfXyMjLAsGGijWKDATK7J+9h LnPhjHd7MKs= =8efW -----END PGP SIGNATURE-----