Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!decwrl!netcomsv!sjsumcs!horstman From: horstman@mathcs.sjsu.edu (Cay Horstmann) Newsgroups: comp.lang.c++ Subject: Re: taking powers with "^" Message-ID: <1991Jun22.144159.18138@mathcs.sjsu.edu> Date: 22 Jun 91 14:41:59 GMT References: <1920003@hpsad.HP.COM> Organization: San Jose State University - Math/CS Dept. Lines: 15 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 ? > There is a good reason that ^ is usually not used for exponentiation. Its precedence is wrong. For example, y = x ^ 2 + 1 is actually y = x ^ (2+1) which is not very intuitive and can lead to frustrating errors. Cay