Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!ssc-vax!cxsea!blm From: blm@cxsea.UUCP (Brian Matthews) Newsgroups: comp.lang.c Subject: Re: "logical" xor Message-ID: <2325@cxsea.UUCP> Date: 11 Jan 88 16:52:13 GMT References: <2946@zeus.TEK.COM> Reply-To: blm@cxsea.UUCP (Brian Matthews) Organization: Computer X Inc. Lines: 22 Dan Tilque (dant@tekla.UUCP) writes: |Doug Gwyn writes: |>>> a ^^ b |>>I think this is about as good a notation as we can get [for exponentiation] |> |>However, as Karl pointer out, this would make a good logical exclusive-or |>operator also, and I can see that the "strong argument" for exponentiation |>would also apply, somewhat more weakly, to exclusive-or, which I've often |>needed and have had to kludge ((a != 0) ^ (b != 0)). |It's not really a kludge so you can stop thinking of as such. It is a bit |verbose but you can just use (a ^ b) and it will do the same thing (*). No it won't. Consider a == 1 and b == 2. (a ^^ b) will result in 0, (a ^ b) will result in 3, which aren't quite the same thing. And, as you point out later, (a ^ b) probably doesn't give anywhere near the expected results that (a ^^ b) give when a and b are float types. -- Brian L. Matthews "A power tool is not a toy. ...{mnetor,uw-beaver!ssc-vax}!cxsea!blm Unix is a power tool." +1 206 251 6811 Computer X Inc. - a division of Motorola New Enterprises