Path: utzoo!mnetor!uunet!husc6!necntc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Power (Re: all those :-) Message-ID: <2334@haddock.ISC.COM> Date: 20 Jan 88 01:14:59 GMT References: <302@Aragorn.dde.uucp> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 21 In article <302@Aragorn.dde.uucp> be@dde.uucp (Bjorn Engsig) writes: >[why he believes a power operator is a bad idea, and apparently that >exponentiation in general should be avoided] I'm only concerned with integral exponents, since the floating-point case is already covered by the standard function pow(). >If you need to calculate x ** n (fortran notation), you will most often need >x ** (n-1) etc. as well If you need to calculate x *^ n (proposed C notation), it is highly likely that n is a small compile-time constant, and that x *^ (n-1) is not of interest. >... Thus: Power with integer exponent is not needed! More precisely, *^ is not needed for the application you're thinking of. But it sure would be useful to be able to write (expr *^ 2) instead of the ugly mess with temp variables that C currently requires. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint