Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!hub.ucsb.edu!ucsbuxa!3003jalp From: 3003jalp@ucsbuxa.ucsb.edu (Applied Magnetics) Newsgroups: comp.lang.fortran Subject: Re: Fortran -vs- C (yet again) Message-ID: <7390@hub.ucsb.edu> Date: 26 Nov 90 19:14:23 GMT References: <1990Nov24.002836.19739@ariel.unm.edu> Sender: news@hub.ucsb.edu Lines: 38 In article <1990Nov24.002836.19739@ariel.unm.edu> john@ghostwheel.unm.edu (John Prentice) writes: >... I would be curious to hear a discussion of what C has >that is so lacking in Fortan, from the perspective >of the scientific programmer, not the computer scientist... Numerical analysis _is_ different from computer science. You worry a lot about applied mathematics, e.g. numerical stability, convergence rates, error estimates (well, you should anyway). By the time you're ready to code, Fortran is just fine. Read the numbers, crunch the numbers, write the numbers. See the introduction to "Numerical Recipes in C" for more opinions. Having said this, there are cases where you wish for more. One of them is finite element analysis. The meshes are often "unstructured" and do not fit naturally in arrays like finite differences used to. You really want more advanced data structures. Still, finite element codes are often written in Fortran. Related to finite elements are sparse matrices, which don't naturally fit into arrays either. There are commercial sparse matrix packages; guess what they're written in? Fortran. On the other hand, you occasionally bump into complex numbers and you find that C doesn't have them. Writing complex arithmetic in terms of function calls is error-prone. If you have C++, you can go back to infix notation, but that brings us to the original issue of this thread: compiler adequacy to numerical analysis. Will the C++/C compiler optimize your complex arithmetic? it doesn't even know that complex addition is commutative. (Correct me if I'm wrong.) My own impression is that numerical analysis meant Fortran, until now. In the past couple of years, workstation vendors started to pay serious attention to floating-point performance. Compilers have improved, including C compilers. There is still room for improvement, though, especially in instruction scheduling. Many of the fast CPUs have pipelined floating-point; keeping the pipelines busy is tricky. --Pierre Asselin, R&D, Applied Magnetics Corp. I speak for myself.