9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Douglas A. Gwyn" <DAGwyn@null.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Problems with pcc
Date: Fri, 16 Nov 2007 10:19:28 +0000	[thread overview]
Message-ID: <473CA7E7.42F1A40F@null.net> (raw)
In-Reply-To: <7b5cf09fd7ee547030c620733fb4cee1@terzarima.net>

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;
}
...


  parent reply	other threads:[~2007-11-16 10:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-12  1:41 Pietro Gagliardi
2007-11-12  2:04 ` erik quanstrom
2007-11-12 14:17 ` Charles Forsyth
2007-11-12 14:24   ` erik quanstrom
2007-11-12 15:05     ` Charles Forsyth
2007-11-12 15:06       ` erik quanstrom
2007-11-12 17:43         ` Charles Forsyth
2007-11-12 20:52   ` Pietro Gagliardi
2007-11-12 22:27     ` Charles Forsyth
2007-11-16 10:19   ` Douglas A. Gwyn [this message]
2007-11-16 10:19   ` Douglas A. Gwyn
2007-11-16 19:46     ` Pietro Gagliardi
2007-11-19 10:15       ` Douglas A. Gwyn
2007-11-19 14:16       ` roland.kaufmann
2007-11-19  2:18   ` Pietro Gagliardi
2007-11-20  9:51     ` Douglas A. Gwyn
2007-11-19  2:22   ` Pietro Gagliardi
2007-11-20  9:51     ` Douglas A. Gwyn
2007-11-16 10:19 ` Douglas A. Gwyn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=473CA7E7.42F1A40F@null.net \
    --to=dagwyn@null.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).