------- 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

Reply via email to