This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: faster log factorials


On Mon, 2003-05-12 at 08:02, James Theiler wrote:


> A still-open question:  If we provide
> pre-computed values, how many should we provide?  For the straight (no
> logarithm) values, there is a natural cutoff at 170 since 170! (or is
> it 171!?) is the largest value that is a valid IEEE double precison
> number.  But for the logs, we can assume the higher the cutoff the
> more often we'll be able to provide a fast precomputed value.  We
> could easily provide thousands, and I think most computers nowadays
> would not begrudge the memory.  But there may be other issues that I
> am not considering.

The natural cutoff is where Stirling's formula becomes good enough.
Computing that way will also be better than a memory access,
I imagine.

If we start using Stirling at 170 then it should be good
enough to take up to sixth order in the series correction.
So we can probably use the same arrays, etc.

I don't remember how the logic works in the factorial functions.
It might need a little tweaking to get optimal performance,
so it takes the right branch without too much fuss.


-- 
Gerard Jungman <jungman@lanl.gov>
Los Alamos National Laboratory


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]