Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/3/84; site cfa.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!talcott!cfa!wyatt From: wyatt@cfa.UUCP (Bill Wyatt) Newsgroups: net.math,net.lang.c,net.arch Subject: Re: Re: Integer division Message-ID: <177@cfa.UUCP> Date: Fri, 31-Jan-86 10:20:06 EST Article-I.D.: cfa.177 Posted: Fri Jan 31 10:20:06 1986 Date-Received: Sat, 1-Feb-86 20:33:35 EST References: <332@ism780c.UUCP> <11603@ucbvax.BERKELEY.EDU> Distribution: net Organization: Harvard-Smithsonian Center for Astrophysics Lines: 19 Xref: watmath net.math:2769 net.lang.c:7720 net.arch:2449 > [ .... ] In C on UNIX, for example, one has > log(-x) == log(x), a rather dangerous identity, not based on anything > comprehensible. Thus, the implementation of general exponentiation, > a**b = pow(a,b) = exp( b*log(a) ) will silently return the wrong value > if a is negative. (Try taking cube roots this way!)] > > ucbvax!brahms!weemba Matthew P Wiener/UCB Math Dept/Berkeley CA 94720 I did the above example (uVax II, Ultrix 1.1) and got a `floating exception'. AHA, I thought , DEC cleaned up this bogosityr! Then I decided to simply print log(-4.0), and it happily printed a garbage number! It would seem that the exception was only because the exp function was delivered a large number. -- Bill UUCP: {seismo|ihnp4|cmcl2}!harvard!talcott!cfa!wyatt Wyatt ARPA: wyatt%cfa.UUCP@harvard.HARVARD.EDU