On Sat, 13 Jun 1998, Moshe Zadka wrote:
> > double pow(double a, int b) {
> > return exp(b*log(a));
> > }
> >
> > Don't a lot of processors have instructions for doing "exp" and "log"?
>
> A *processor* instruction for exp/log? What processor are you talking
> about? (References from assmebly manuals, please).
Actually, I wasn't really referring to any particular cpu. More just
asking the question. I sorta realise now how proposterous this idea is,
considering how much calculation is needed for these operations. I
should've thought twice before posting really, since it was only the other
day when I was using an exponential scheme to cut a few computational
corners. What I was doing was representing numbers by their exponent of
1.000000001. The conversions were pre-calculated, but it meant that I
could multiply and stuff with an add, etc. For example, say x was
represented by x_, i.e. x == 1.0000000001^x_ So, to do x * y, all you
need to do is x_ + y_. Since the x_ values were pre-calculated, I didn't
worry about the computation time. This was what prolly clouded my thought
on the topic. Sorry for the rash post. I even should've remembered that
I couldn't do an add of two numbers in this scheme without doing an exp
and a log, which were too expensive for non-pre-calculated computation.
Although if anyone can come up with a way that I could do an add, please
mail me. :)
Pete
Pete Ryland Home phone: +61 2 9697 9262 Mobile: 014 035 802
email: [EMAIL PROTECTED] ICQ UIN: 4256333
WWW: http://www.pdr.ml.org ftp: ftp.pdr.ml.org