Charles Forsyth wrote:
> ape doesn't provide gamma or cbrt, but if they're in c99 i suppose it could.
> just add a local copy temporarily.
> gamma isn't in my copy of c99 though: it defines lgamma and tgamma.
> (the old gamma actually computed lgamma, i think.)

Yes, the name "gamma" had been used for both the gamma function
and its logarithm, on different platforms, so the C standard uses
other names for each of them.  My version looks like:

/* hoc/math.c */
#include <math.h>
#if defined(__STDC__) && !defined(gamma)
#define gamma(x)        lgamma(x)       /* new name */
#endif
extern int signgam;
...
double
Gamma(x)
        double x;
{
        double y;
        y = errcheck((double)gamma(x), "gamma");
#if 0   /* DAG -- not needed with following check on exp(y) */
        if (y > 88.0)
                execerror("gamma result out of range", (char *)0);
#endif
        y = errcheck((double)exp(y), "gamma");  /* DAG -- added check */
        return signgam * y;
}
...

Reply via email to