Path: utzoo!attcan!uunet!husc6!uwvax!rutgers!bellcore!tness7!tness1!sugar!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.fortran Subject: Re: Fortran versus C for numerical analysis Message-ID: <1449@ficc.uu.net> Date: 9 Sep 88 20:56:10 GMT References: <1421@ficc.uu.net> <3349@lanl.gov> Organization: SCADA Lines: 39 Hi Jim... you should meet Mr. Rubin over in comp.lang.c. In article <3349@lanl.gov>, jlg@lanl.gov (Jim Giles) writes: > From article <1421@ficc.uu.net>, by peter@ficc.uu.net (Peter da Silva): > > ...(1.0+x)*2.0 can be evaluated as 2+2*x... > This was just a badly chosen example. Suppose the expression had been: > (1.2345+x)*6.7890? Applying the distributive law to this doesn't > produce the same computational result. No. > The question is: should the optimization be allowed anyway? No. > The rules of Fortran don't allow it, the rules of C (there are rules in C?) > do. The rules of ANSI X3J11 do require that this optimisation not be taken. > The problem with C is that > it provides _no_ way to force a given order of expression evaluation Yes, this is a shortcoming addressed by ANSI X3J11. Other shortcomings addressed by this standard (and shared, by the way, by Fortran) include such things as the lack of function prototyping and a guaranteed method for handling I/O devices and other asynchronous processing (volatile). > (ANSI doesn't count - expression ordering of one kind or another has > been proposed and removed so many times that there is no way of telling > whether the final standard will have the feature or not). Given the fact that it's now in the final stages, and only editorial changes are allowed (as in, this or that wording is unclear...), it's highly unlikely that it will be removed. -- Peter da Silva `-_-' Ferranti International Controls Corporation. "Have you hugged U your wolf today?" peter@ficc.uu.net