Per Persson wrote:
> On Sep 26, 2006, at 22:06, Ethan Merritt wrote:
>
>
>>On Tuesday 26 September 2006 12:49 pm, Per Persson wrote:
>>
>>>Hi all,
>>>sorry for being late to the party, but I've been busy buing a
>>>house...
>>
>>Congratulations!
>
>
> Thanks!
>
>
>>No, it's more complicated than that.
>>The problem is that the name "gamma" has historically been used
>>on some systems to refer to the function that is now called
>>"lgamma", and on other systems at other times to refer to a
>>function that is equivalent to "tgamma". Thus we cannot tell
>>from the name exactly what its behaviour is.
>>
>>Gnuplot's auto-configure, as I understand it, is looking for a
>>function named "gamma" and assuming that it behaves like lgamma
>>with additional information about the sign of the result returned
>>in extern sgngam. I am worried that on the Mac in question,
>>"gamma" is instead acting like "tgamma". That's not broken;
>>it's just a different naming convention. My thought was that
>>in this case we should test first for a function named "tgamma",
>>and use it along with its slightly different API.
>
>
> OK, if I understand things correctly, then we could
> 1) make configure check for gamma, lgamma, and tgamma *and* check
> each of them (including tgamma to be on the safe side;-) e.g.:
>
> AC_TRY_RUN([
> int main()
> {
> return gamma(2.0) < 1.0;
> }
> ]
> , [ echo "gamma is GAMMA" ]
> , [ echo "gamma is LOG_OF_GAMMMA" ]
> )
>
> to see if they are in reality $\ln\Gamma$ (LaTeX notation) and use
> them in order:
> HAVE_LGAMMA && LGAMMA_IS_LOG_OF_GAMMA
> HAVE_GAMMA && GAMMA_IS_LOG_OF_GAMMA
> HAVE_TGAMMA && TGAMMA_IS_LOG_OF_GAMMA
> Keeping the current code in in specfunc.c (and file a bug report with
> whoever implemented the last combo).
>
> 2) make configure check for tgamma *and* verify that it is $\Gamma$
> (LaTeX notation):
> HAVE_TGAMMA && !TGAMMA_IS_LOG_OF_GAMMA
> change the current code to use tgamma, and let systems without tgamma
> rely on a fallback solution in specfunc.c
>
> If the above is correct, then I'd support (2) but I guess it boils
> down to how much work it would need.
>
> /Per
Very good idea Per. In fact, this could be carried further to run-time. Gnuplot could have a line of code similar to the above at the start of its "main" function in the case it has to fall back on gamma(). Then have a conditional statement in specfun.c. Is there an advantage to doing this in the case of gnuplot being compiled on a system different from where the eventual libraries are? (Or is that pretty much made fool proof now with module i.d.s?)
Chris, identifying exactly what your gamma() routine is would be nice. (Just replace the "tgamma()" of that patch with "gamma()" and observe the very first figure of prob.dem.)
Dan
|