Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!cornell!uw-beaver!teknowledge-vaxc!sri-unix!quintus!ok From: ok@quintus.uucp (Richard A. O'Keefe) Newsgroups: comp.lang.fortran Subject: Re: Fortran versus C for numerical analysis Message-ID: <406@quintus.UUCP> Date: 15 Sep 88 07:12:29 GMT References: <893@amelia.nas.nasa.gov> <3064@lanl.gov> <820@cernvax.UUCP> Sender: news@quintus.UUCP Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Organization: Quintus Computer Systems, Inc. Lines: 20 In article <820@cernvax.UUCP> hjm@cernvax.UUCP (Hubert Matthews) writes: > I = 5 / 4 * 5 (I gets 5 in F77, I gets something in C) > >Personally, I wouldn't use [this]; 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. This is not ambiguous in C, and never has been. % echo "I = 5 / 4 * 5;" | cparen I = ((5 / 4) * 5); In fact, this is one of the reasons why some C programmers resent the Fortran people telling them what to do with parentheses: C programmers are used to adding parentheses to expressions to clarify the grouping *without* changing the semantics. The point at issue is whether I = N * P * Q; and I = (N * P) * Q; have the same meaning. In pre-ANSI C, they did; a compiler could rearrange both. In the current draft, the two expressions are different, exactly as in Fortran.