------- Comment #8 from burnus at gcc dot gnu dot org 2007-10-09 22:06 ------- > We'll probably need to roll our own tgamma function: To > cover cases like this, where the system doesn't provide > one, and to get numerically better answers.
g95 uses a C version of W. J. Cody and L. Stoltz' Fortran procedure available from http://www.netlib.org/specfun/gamma If I read GLIBC correctly, it implements gamma as exp(lgamma(x)), which explains why the results are not optimal, cf. http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/math/w_tgamma.c?cvsroot=glibc http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/ieee754/dbl-64/e_gamma_r.c?cvsroot=glibc Initially, I had claimed that it is better to use the C99/POSIX-2001 tgamma function of the system C library (if available), but now I am not so sure anymore. -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33698