From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu Date: Fri, 16 Nov 2007 10:19:28 +0000 From: "Douglas A. Gwyn" Message-ID: <473CA7E7.42F1A40F@null.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit References: <8FE905C8-9071-4DF4-B4E2-76A3991C4D0B@mac.com>, <7b5cf09fd7ee547030c620733fb4cee1@terzarima.net> Subject: Re: [9fans] Problems with pcc Topicbox-Message-UUID: fceafd1c-ead2-11e9-9d60-3106f5b1d025 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 #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; } ...