Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!umbc3!mbph!hybl From: hybl@mbph.UUCP (Albert Hybl Dept of Biophysics SM) Newsgroups: comp.lang.fortran Subject: Re: operator precedence on FORTRAN 77 Summary: Let's BOO the suicide idea Keywords: unary minus, exponenation Message-ID: <606@mbph.UUCP> Date: 5 Sep 89 22:31:28 GMT References: <3744@uwovax.uwo.ca> <8980@saturn.ucsc.edu> <320@unmvax.unm.edu> Distribution: na Organization: University of Maryland, School of Medicine, Baltimore, MD 21201 Lines: 82 In message <8980@saturn.ucsc.edu> from sla@helios.ucsc.edu, Steve Allen posted a short validation program and asked what the correct interpretation should be: > double precision func1, func2, func3, func4 > func1 = 10.D0** -(3.D0)/2.D0 > func2 = 10.D0**(-(3.D0)/2.D0) > func3 = 10.D0** -3.D0 /2.D0 > func4 = 10.D0** - 3.D0 /2.D0 > write(*,*) func1, func2 > write(*,*) func3, func4 > end The gentleman from the University of New Mexico at Albuquerque speaking in a firm, judicial voice provided the interpretation in message <320@unmvax.unm.edu>: }The expressions in all but func2 are illegal in F77 and still will be }illegal in the proposed F8x. He then explains why X3.9-1978 FORTRAN fails to provide users with a portable standard--i.e., the suicide sentence! } Therefore, all of the implementations }cited have treated this as an extension and are free to give any }interpretation they want. IMPLEMENTORS SHOULD NOT BE FREE TO GIVE ANY INTERPRETATION THEY WANT! THEY SHOULD REPORT AN ERROR AND/OR SUBMIT THE PROBLEM FOR ADJUDICATION! How can a validation suite be useful to either the user or the implementor when ALL of the following disparate answers are legal because they are standard conforming or allowed because they are NOT standard conforming? From and AT&T 3B1 using SVS fortran MC68000 FORTRAN 77 Compiler V2.2 21-May-84 2. *********** func1 = 10.D0** -( <=== 3.D0)/2.D0 ***** Error number 50 in line 2 of file allen.for ***** ***** Illegal symbols in an expression ***** 4. *********** func3 = 10.D0** -3 <=== .D0 /2.D0 ***** Error number 50 in line 4 of file allen.for ***** ***** Illegal symbols in an expression ***** 5. *********** func4 = 10.D0** - <=== 3.D0 /2.D0 ***** Error number 50 in line 5 of file allen.for ***** ***** Illegal symbols in an expression ***** 3 errors. 8 lines. File allen.for From an IBM-PC/AT using the IBM Professional FORTRAN Compiler (V1.21) by Ryan-McFarland Corp 2 func1 = 10.D0** -(3.D0)/2.D0 ? 1 ** ERROR ** : UNRECOGNIZABLE SYNTAX AT THIS POINT 4 func3 = 10.D0** -3.D0 /2.D0 ? 1 ** ERROR ** : UNRECOGNIZABLE SYNTAX AT THIS POINT 5 func4 = 10.D0** - 3.D0 /2.D0 ? 1 ** ERROR ** : UNRECOGNIZABLE SYNTAX AT THIS POINT From an AT&T 3B2/400 using Fortran 77 XLA+ 5.000000000E-004 3.162277660E-002 5.000000000E-004 5.000000000E-004 >Sun Fortran 1.x (x is either 0 or 1, I'm not sure) >on a Sun4 with SunOs 4.0.y (y is either 0 or 1, ditto) gives > 5.0000000000000D-04 3.1622776601684D-02 > 5.0000000000000D-04 5.0000000000000D-04 > >VAX FORTRAN V4.7-271 on a MicroVax II with VMS V4.7 gives > 3.1622776601683793E-02 3.1622776601683793E-02 > 3.1622776601683793E-02 3.1622776601683793E-02 > >Mips Computer Systems 1.31 Fortran on a SGI 4d/220 > running IRIX V3.1F gives > 3.1622776601683790E-02 3.1622776601683790E-02 > 3.1622776601683790E-02 3.1622776601683790E-02 > Three cheers for AT&T/SVS and IBM/RM. A BIG BOO for the suicide idea! ---------------------------------------------------------------------- Albert Hybl, PhD. Office UUCP: uunet!mimsy!mbph!hybl Department of Biophysics Home UUCP: uunet!mimsy!mbph!hybl!ah University of Maryland CoSy: ahybl School of Medicine Baltimore, MD 21201 Phone: (301) 328-7940 (Office) ----------------------------------------------------------------------