Fortran vs. C for numerical work
John A. Weeks III
john at newave.UUCP
Sun Dec 2 17:03:20 AEST 1990
In a somewhat long discussion...
> > > It is often stated that Fortran is better than C for numerical work.
> > It may not be true any more. A friend of mine brought a little fortran
> > program (It is two big do loops with some instrinsic function calculation
> > in the loop.) and the C translation of the fortran program. We compiled two
> > program on a IBM RISC System 6000/530 with xlc and xlf. To my surprise, the
> > excutable from C is faster than the excutable from Fortran by a few percent.
I hope that numerical quality is not always measured by speed. If my
recent experience means anything, I think that Fortran implementations
generally have more well behaved numerical libraries, documented behavior,
and better error handling. And since FORTRAN is noted for numerical work,
someone usually tests the floating point stuff before the compiler is
shipped. I have encountered C compilers that made me wonder if + and - was
even tested. Of course, I remember things that don't work longer than
I remember things that do work flawlessly 8-).
The speed that FORTRAN is noted for can be found on the big IBM boat
anchors. COBOL and FORTRAN rule on those machine for speed (discounting
assembler) with C being something like 10 times slower when performing
similar tasks (based on benchmarks with the IBM & SAS compilers). C style
I/O is especially slow on IBM mainframes because those machines work best
with record I/O and C programmers tend to think in streams of characters.
-john-
--
===============================================================================
John A. Weeks III (612) 942-6969 john at newave.mn.org
NeWave Communications ...uunet!rosevax!tcnet!wd0gol!newave!john
===============================================================================
More information about the Comp.lang.c
mailing list