Path: utzoo!utgpu!water!watmath!clyde!ima!bbn!rochester!quiroz From: quiroz@cs.rochester.edu (Cesar Quiroz) Newsgroups: comp.lang.c Subject: Re: pow again Summary: Argh! Message-ID: <5856@sol.ARPA> Date: 13 Jan 88 22:03:27 GMT References: <629@PT.CS.CMU.EDU> <5825@sol.ARPA> <7071@brl-smoke.ARPA> Reply-To: quiroz@ROCHESTER.UUCP (Cesar Quiroz) Organization: U of Rochester, CS Dept, Rochester, NY Lines: 44 Expires: Sender: Followup-To: From article <7071@brl-smoke.ARPA> (gwyn@brl-smoke.ARPA (Doug Gwyn )): :In article <5825@sol.ARPA>, quiroz@cs.rochester.edu (Cesar Quiroz) writes: :> There is no such thing as a unique, universally accepted :> definition for the exponentiation. : :I don't buy this. : Neither do I! I found myself arguing against my own position (this bad habit of posting when late and lacking sleep). The confusion came about this way: Somebody (I think E. Wyatt) argued that expt(-2,3) could be chosen to be either -8 real or -8 + 0i complex (which happens to project into a real, of course). My article tried to defend the point that there is no such choice, the universally accepted *definition* for exponentiation is the complex one. The problem is that the *implementation* of some special cases (those with rational exponents) can be made very efficient, by ignoring that it doesn't generalize into a continuous function in any sensible way. Same goes for sqrt, where the NonNegative->Real definition can be made very efficient (by a Newton-Raphson iteration, for instance) while exponentiation to the 0.5 (or negative arguments for the common sqrt) might involve more expensive stuff. Catering for efficiency in such special cases I find defensible (so the power functions you posted are desirable in the library). The noise about sqrt reduces to this: There are no negative numbers for which we might want to define a real square root, so setting EDOM or signalling a matherr for all the negatives is good enough. With pow, some negative integer exponents produce complex numbers that can be identified with reals, and so there are people who find useful to believe that -2^3 = -8, although they don't know how to define things like -2^3.1. Catering to this sloppiness, even if it happens to argue for the same library functions, is what I found indefensible. -- Cesar Augusto Quiroz Gonzalez Department of Computer Science ...allegra!rochester!quiroz University of Rochester or Rochester, NY 14627 quiroz@cs.rochester.edu