Date: Sun, 15 Jul 2001 07:10:01 -0700 (PDT) From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/28972: gamma returns same result as lgamma Message-ID: <200107151410.f6FEA1l50588@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/28972; it has been noted by GNATS. From: Bruce Evans <bde@zeta.org.au> To: Stephen Montgomery-Smith <stephen@math.missouri.edu> Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/28972: gamma returns same result as lgamma Date: Mon, 16 Jul 2001 00:02:58 +1000 (EST) On Sat, 14 Jul 2001, Stephen Montgomery-Smith wrote: > The function gamma in the math library gives the wrong answer - it gives the > same answer as lgamma. ... This is intentional (except for the broken man page). gamma was actually the log of gamma in many old Unix libraries. I think these libraries had no actual gamma function. I'm not sure if they had the log of gamma named as lgamma. Net/2 and 4.4BSD attempted to fix this by implementing gamma and actually naming it gamma. This mainly confused everything which knew that gamma was actually lgamma. FreeBSD replaced the Net/2 libm by the Sun fdlibm in FreeBSD-1 and kept using it in FreeBSD-[2-5]. gamma is actually the log of gamma again in fdlibm. C99 "fixed" this in a backwards-compatible by bogusly naming gamma as tgamma (true gamma). C99 has tgamma and lgamma, but no gamma. Previous C standards didn't specify any gamma functions. C99 and tgamma aren't implemented under FreeBSD yet (especially the former). libm/common_source/gamma.c can probably be ported easily to get a reasonably good version of tgamma (I expect it would be better than exp(lgamma) but not as good as lgamma). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107151410.f6FEA1l50588>