Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!sdd.hp.com!decwrl!csus.edu!borland.com!pete From: pete@borland.com (Pete Becker) Newsgroups: comp.lang.c++ Subject: Re: taking powers with "^" Message-ID: <1991Jun22.181859.6798@borland.com> Date: 22 Jun 91 18:18:59 GMT References: <1920003@hpsad.HP.COM> Organization: Borland International Lines: 11 In article <1920003@hpsad.HP.COM> sdw@hpsad.HP.COM (Steve Warwick) writes: >when ATT built the complex class, C++ became my favourite language for numerical processing and analysis. however, I'm still looking for one little friend, >the power symbol "^" as in 10^5, x^y. Can/Has someone defined a set of >friend functions for integer/double/complex numbers ? I haven't looked, but there's a danger in using ^ for exponentiation. It doesn't group the way it should! In C++, ^ groups from left to right, just as in C. But when doing exponentiation, it should go the other way. A^B^C is evaluated as (A^B)^C, which is not at all the same as A^(B^C).