This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: faster log factorials
- From: Gerard Jungman <jungman at lanl dot gov>
- To: gsl-discuss at sources dot redhat dot com
- Date: 12 May 2003 15:55:23 -0600
- Subject: Re: faster log factorials
- Organization: Los Alamos National Laboratory
- References: <Pine.LNX.4.33.0305112259330.24213-100000@yks.lanl.gov>
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