From owner-freebsd-bugs Sun Jul 15 7:10: 4 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id CAFEE37B401 for ; Sun, 15 Jul 2001 07:10:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f6FEA1l50588; Sun, 15 Jul 2001 07:10:01 -0700 (PDT) (envelope-from gnats) Date: Sun, 15 Jul 2001 07:10:01 -0700 (PDT) Message-Id: <200107151410.f6FEA1l50588@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: bin/28972: gamma returns same result as lgamma Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/28972; it has been noted by GNATS. From: Bruce Evans To: Stephen Montgomery-Smith 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