[comp.lang.c] DIfferences among Languages for Number Crunching?

ndeng@EULER.BERKELEY.EDU (03/03/90)

I have a question about which language is the "best" for scientific 
computation (read: number crunching), especially for execution speed.
A majority of people use FORTRAN, not because this language is good or
flexible, but due to historical reasons. Some others use C or Pascal,
which offer better system interaction and graphics support. There is 
also a group of people who still use BASIC or ALGOL. I wonder if anybody
has used two or more different languages to solve an identical problem
and compared the results for speed/accuracy differences. Do the C/Pascal/BASIC
version of LINPACK or Livermore Bunchmarks exist?  How about the speed 
of these bunchmarks when compared with FORTRAN version? I think this
would be a topic of general interest and would like to see discussions.

I apologize if this topic has been discussed before. (In that case, would
somebody be kind enough to give me some hints for whereabout of the 
discussion archives?) And also, please no flames, I am not trying to compare
apples and oranges. If I get enough responses by e-mail, I'll post a
summary. 

N. Deng
ndeng@euler.berkeley.edu
-----------------------------
Standard Disclaimer Applies.

yahoo@unix.cis.pitt.edu (Kenneth L Moore) (03/05/90)

In article <9003021955.AA28774@euler.Berkeley.EDU> ndeng@EULER.BERKELEY.EDU writes:

=>I have a question about which language is the "best" for scientific 
=>computation (read: number crunching), especially for execution speed.

=>N. Deng
=>ndeng@euler.berkeley.edu

=>Standard Disclaimer Applies.

Here is a posting that I just made to sci.math.num-analysis. It
was a summary of mail I got in response to posting the question,
"What language do YOU use for numerical analysis?"

In the case of FORTRAN and C (the major languages mentioned), I tried to
include a summary of what people thought were the advantages of their
choice.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

1  APL2
1  Assembler
1  ALGOL
1  BASIC
1  Common Lisp   
1  Common Lisp Object System
13 FORTRAN
15 C
4  C++
1  Bliss
1  Forth
4  Pascal
1  Modula-2
1  S


FORTRAN - complex numbers, arrays at 1, existing debugged code such as 
          Eispak & Linpac, bounds checking, supercomputing, portability, 
          speed of execution, does not promote float to double, compact code, 
          double double precision, the way arrays are handled, intrinsic
          functions such as 2**3.2 MAX and Min, each variable does not 
          have to be declared

C - systems interface, algorithm translation (structures), 
    portability, allows for development of a user friendly front end, 
    compact code, speed of development, speed of execution, 
    readability, dynamic memory allocation, flexible.
-- 
I don't yell and I don't tell and I'm grateful as hell: Benny Hill

bright@Data-IO.COM (Walter Bright) (03/06/90)

In article <9003021955.AA28774@euler.Berkeley.EDU> ndeng@EULER.BERKELEY.EDU writes:
<I have a question about which language is the "best" for scientific 
<computation (read: number crunching), especially for execution speed.

I hate to say it, but Fortran is still the best for the following reasons:
1. It's been around the longest, so the floating point routines are
   very mature and reliable. Lots of people rely on this stability, so
   if an implementation is weak in this regard, it's quickly corrected.
   C is not as well used for number crunching, and so the libraries are
   less well developed and less used.
2. Fortran has built-in support for complex data. Yeah, I know, you can
   fake it in C++. But nothing matches the convenience of being able to
   say:
	z = a + b*i
   Hardwiring a type into the compiler produces better results than
   a user-defined type.
3. Fortran has variably-dimensioned arrays. Doing this in C is a bit
   klunky.
4. Fortran compilers tend to optimize better than C compilers, because
   a) they've been around longer and b) have less aliasing problems.

There's a group, the NCEG, trying to address these deficiencies in C.

(BTW, Fortran is a miserable language for doing about anything else!)