Path: utzoo!attcan!uunet!mcvax!cernvax!hjm From: hjm@cernvax.UUCP (Hubert Matthews) Newsgroups: comp.lang.fortran Subject: Re: Fortran versus C for numerical analysis Message-ID: <820@cernvax.UUCP> Date: 13 Sep 88 15:47:58 GMT References: <893@amelia.nas.nasa.gov> <3064@lanl.gov> Reply-To: hjm@cernvax.UUCP (Hubert Matthews) Organization: CERN European Laboratory for Particle Physics, CH-1211 Geneva, Switzerland Lines: 16 Consider the following cases: I = (5 / 4) * 5 (I gets 5) I = 5 / (4 * 5) (I gets 0) I = 5 / 4 * 5 (I gets 5 in F77, I gets something in C) Personally, I wouldn't use case 3; I would always enforce an evaluation order by using parentheses. If this could be ambiguous in C, I wouldn't use it for numerical work. The same problem occurs when using mixed-mode arithmetic. Evaluation order is important, and parentheses are the most obvious way of expressing it. Temporary variables are a hack. Hubert Matthews