I've put a patch on SourceForge that will use the library "true gamma" whenever gamma(x) is required, otherwise fall back on gp_gamma(). Similarly, it will use the library "natural log gamma" whenever ln(gamma(x)) is required, otherwise fall back on gp_lgamma().
It does not use of the math library's gamma() or signgam. (Configure now only checks for tgamma and lgamma, no longer gamma or signgam.) Hopefully, the majority of platforms will use the library tgamma() by now.
The code derives the "undefined" status from the floating point exceptions as described in the man pages. I'm assuming that gnuplot's version of the gp_lgamma() routine sets such exceptions. In any case, I've verified both the library and gnuplot internal versions of the gamma and lngamma functions in prob.dem.
If one wants to add a little extra to attempt to use gamma() as a last resort, this patch would make a good start. However, I'd sort of advocate not attempting to use gamma() unless someone can convince me otherwise.
Dan
