Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!ncar!tank!uxc!uxc.cso.uiuc.edu!uxg.cso.uiuc.edu!uxe.cso.uiuc.edu!hirchert From: hirchert@uxe.cso.uiuc.edu Newsgroups: comp.lang.fortran Subject: Re: Fortran versus C for numerical anal Message-ID: <50500074@uxe.cso.uiuc.edu> Date: 8 Sep 88 20:39:00 GMT References: <893@amelia.nas.nasa.gov> Lines: 25 Nf-ID: #R:amelia.nas.nasa.gov:893:uxe.cso.uiuc.edu:50500074:000:1246 Nf-From: uxe.cso.uiuc.edu!hirchert Sep 8 15:39:00 1988 Dominick Samperi(samperi@djs.UUCP) asks: >I don't have a copy of the official FORTRAN standard handy, but there appears >to be an inconsistency in the specifications. Specifically, most references on >FORTRAN state that the primitive operators associate left to right, except >for **, which associates right to left. This would imply that A+B+C will >be evaluated as (A+B)+C. >On the other hand, I have verified that the FORTRAN definition explicitly >allows any FORTRAN implementation to rearrange the order of evaluation of >an expression for optimization in any manner, provided that operator >precedence rules are obeyed, and parentheses are respected. Does this not >contradict the left-to-right/right-to-left rules mentioned above? Left to right precedence means that A-B+C is interpreted mathematically as (A-B)+C and not A-(B+C). Freedom of evaluation order (in the absence of explicit parentheses) means that mathematical (A-B)+C could be evaluated as (A+C)-B or even A-(B-C). >Dominick Samperi > samperi@acf8.nyu.edu uunet!hombre!samperi > cmcl2!acf8!samperi rutgers!acf8.nyu.edu!samperi > (^ ell) Kurt W. Hirchert hirchert@ncsa.uiuc.edu National Center for Supercomputing Applications