|
From: Daniel J S. <dan...@ie...> - 2006-09-28 22:16:41
|
Ethan Merritt wrote: > ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic") > and > POSIX 2001 (IEEE Std 1003.1:2001) > > require lgamma() to provide signgam as an extern int I don't necessarily read it that way. The language is not clear on that. I'll interject my interpretation in the quote: > I quote from the document > "Rationale for International Standard Programming Languages > C Revision 5.10 April-2003" > > 7.12.8.3 The lgamma functions > New feature for C99. Since the mathematical gamma function increases in > value so quickly (it is around 10306 for an argument of only 170), the > logarithm of gamma extends the useful domain. Also, for computing > combinations and permutations, it is the quotient of the (potentially > large) gammas that is needed; taking differences of the lgammas instead > allows for calculations without overflow. In Single Unix, a call to > lgamma sets an external variable, signgam, to the sign of gamma(x), > which is 1 if x < 0 && remainder(floor(x), 2) != 0. OK, here's the first mention of signgam. Is it stating that signgam is supposed to be present and related to lgamma()? Not directly, and for that reason I'm not sure that is what is meant. What is "Single Unix"? Is that the C99 standard? Or is this referring to some outside definition, i.e., some legacy definition? If that is the case, then all this sentence is stating is somewhere in the community there is an implementation of lgamma() which sets something called signgam. Note that this > specification does not remove the external identifier signgam from the > user's name space. What does this sentence say? It says that the definition is not specifically calling for the removal of signgam from the name space. I.e., it is allowed to hang around. (Unfortunately that is the source of confusion.) > An implementation that supports lgamma's setting of > signgam as an extension must still protect the external identifier > signgam if defined by the user. Why would they say "an implementation that supports" if the standard is to always support it? All this sentence is saying is that the "signgam" must be protected if the user defines such a variable. I still haven't seen anything that specifically calls out that in C99 lgamma() must or should support signgam. Dan |