This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33698] FAIL: gfortran.dg/gamma_5.f90
- From: "dave at hiauly1 dot hia dot nrc dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Oct 2007 02:11:51 -0000
- Subject: [Bug fortran/33698] FAIL: gfortran.dg/gamma_5.f90
- References: <bug-33698-276@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from dave at hiauly1 dot hia dot nrc dot ca 2007-10-09 02:11 -------
Subject: Re: FAIL: gfortran.dg/gamma_5.f90
> /* Functions built into gcc itself. */
> +#ifndef tgamma
> +#define tgamma gamma
> +#endif
> +
> #include "mathbuiltins.def"
The HP-UX 11 manpage says:
lgamma() and gamma() return ln(|Gamma(x)|), where Gamma(x) is defined
as the integral, as t goes from zero to infinity, of exp(-t) times t
to the power (x-1).
The sign of Gamma(x) is returned in the external integer signgam.
The following C program fragment can be used to calculate
Gamma(x):
if ((y = lgamma(x)) > LN_MAXDOUBLE)
error();
y = signgam * exp(y);
where if y is greater than LN_MAXDOUBLE, as defined in the <values.h>
header file, exp() returns a range error (see exp(3M)).
There's also a reentrant version lgamma_r:
double lgamma_r(double x, int *sign);
The main point is the HP-UX gamma function isn't the true gamma function.
Dave
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33698