Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ihlpf!nevin1 From: nevin1@ihlpf.ATT.COM (00704A-Liber) Newsgroups: comp.lang.c Subject: Re: Power proposal for ANSI C Keywords: power exponentiation ** Message-ID: <3438@ihlpf.ATT.COM> Date: 20 Jan 88 01:15:52 GMT References: <38384@sun.uucp> <2252@haddock.ISC.COM> Reply-To: nevin1@ihlpf.UUCP (00704A-Liber,N.) Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 31 In article <2252@haddock.ISC.COM> karl@haddock.ima.isc.com (Karl Heuer) writes: . .If this were the only criterion, I'd say it should be put into a new .precedence class between unary and multiplicative. However, this makes -x*^2 .mean the "wrong" thing. If this is a problem (apparently bc users don't .mind), my recommendation is to give it a precedence between postfix unary and .prefix unary. (Note that "->id", ".id", "[expr]", and "(arglist)" can all be .considered postfix unary, just as "(type)" can be considered prefix unary.) Looking at my chart on precedence and associativity, I noticed that all the unary operators are grouped together, group right to left, and are above all the binary operators. Putting the power operator above the unary operators would produce lots of uncompilable statements;i.e., (++a POW ++b) would be illegal. (Note: I do not consider (), [], ., or -> to be either unary or binary; they are special operators and cannot be grouped in with the other unary operators). As I have said before, I do not believe that we should split up the unary operators; too many programs are dependent on the fact that they all have the same precedence (splitting the unaries into prefix and postfix groups would fix the example above, however). .I think 2 *^ -1 should be undefined (as is 1 << -1), rather than zero. One of the reasons I can't agree with this is that 2 *^ ((float)(-1)) would work, but 2 *^ (-1) would not. (I stated in another article what I believe 2 *^ (-1) should do *IF* we were to add the power operator, which I am against doing.) -- _ __ NEVIN J. LIBER ..!ihnp4!ihlpf!nevin1 (312) 510-6194 ' ) ) "The secret compartment of my ring I fill / / _ , __o ____ with an Underdog super-energy pill." / (_