Integer division
Bill Wyatt
wyatt at cfa.UUCP
Sat Feb 1 01:20:06 AEST 1986
> [ .... ] 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 at harvard.HARVARD.EDU
More information about the Comp.lang.c
mailing list