[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: OT : Approximate / fast math libraries ?



On Tue, 4 Sep 2007, Mike McCarty wrote:

> Mogens Kjaer wrote:
> > Chris Jones wrote:
> > ...
> >
> >> for the profiler output. atan2 is taking 50% of the time of this
> >> method. Not here I don't need that much precision on the result - say
> >> +- O(2*pi/100).
> >
> >
> > Can't you use a Taylor expansion of arctan?
>
> In a word, NO. Taylor's series are TERRIBLE ways to do numerical
> approximations. In effect, they make an infinitely precise estimate
> at the expense of everything else. You want an approximation which
> is valid over an interval.

The size of the interval over which an approximation
is valid usually depends on the desired accuracy
whether or not the approximation is Taylor series.
That said, given the desire for a maximum error,
a polynomial approximation and a given interval,
one should probably use Chebyshev polynomials.


Better yet would be to use the hardware instructions.
According to at least one speed test, cosines and arctangents
each take about as long as a dozen multiplications.
http://www.obliquity.com/computer/speedtest.html

-- 
Mike   hennebry web cs ndsu NoDak edu
"Horse guts never lie."  -- Cherek Bear-Shoulders


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]