[ADMB Users] factln

John Sibert sibert at hawaii.edu
Tue Aug 27 14:38:02 PDT 2013


Has any one noticed small errors in double factln(double n) for small 
values of n?
I'm getting the following for n = 0 ... 5
n    factn(n)        n!
0 -3.41362e-11  1
1 -7.81881e-11  1
2  0.693147  2
3  1.79176  6
4  3.17805  24
5  4.78749  120
Which seem to be incorrect for n=0 and n=1. The difference between 1e-11 
is quite small but it turns out to make a difference after a 
sufficiently long computation.

The algorithm depends on a series approximation for the log gamma 
function. Perhaps arguments 0 and 1 should be treated a special cases?

Cheers,
John

-- 
John Sibert
Emeritus Researcher, SOEST
University of Hawaii at Manoa
Honolulu HI (GMT-10)
808-294-3842

Visit the ADMB project http://admb-project.org/




More information about the Users mailing list