Boost logo

Boost :

From: Daniel Spangenberg (dsp_at_[hidden])
Date: 2003-08-25 03:31:17


"Philippe A. Bouchard" schrieb:

> Philippe A. Bouchard wrote:
>
> > Yeah, a fixed point library is also interesting but first of all we have
> > to
> > find a precise pow() function that can handle rational exponents. I do
> > not recommend using x^y = e^(x * ln(y))... for those who have encountered
> > the problem.
>
> Euh, I meant the following identity:
> x^y = e^(y * ln(x))
>
> Because it can be faster. Does anyone know the Cordic algorithm?

1) Do you mean the special case of rational exponents of odd denominator iff the
base is negative?
Although I studied some quite good algorithms from

Stephen L. Moshier: Methods and Programs for Mathematical
Functions, Prentice-Hall, 1989

and some of his C implementations (See the cephes pages at
http://netlib.ccp14.ac.uk/cephes/)

I did not find any handling of this special case and regrettably the current C
standard does
not give special requirements for this case.

When I was an Object Pascal (aka Delphi) programmer in my former life, I wrote a
pow
function which handled this special case. It is quite easy, because its actually
calculation
can be directed onto the usual implementation (whatever it is, maybe a polynomial
series)
just after its detection.

2) I haven't heard of the Cordic algorithm until your posting, but Moshier used
polynomial series
for special ranges of the pow arguments as far as I remember (See his book or have
look into cephes).

Concerning The Cordic algorithm: There seems to be an interesting paper on

http://www.dec.usc.es/arith16/papers/paper-171.pdf

Greetings,

Daniel Spangenberg


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk