From owner-freebsd-bugs Sun Nov 4 21:20: 8 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 677CD37B418 for ; Sun, 4 Nov 2001 21:20:00 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id fA55K0V02685; Sun, 4 Nov 2001 21:20:00 -0800 (PST) (envelope-from gnats) Received: from netau1.alcanet.com.au (ntp.alcanet.com.au [203.62.196.27]) by hub.freebsd.org (Postfix) with ESMTP id F2D0D37B416 for ; Sun, 4 Nov 2001 21:17:27 -0800 (PST) Received: from mfg1.cim.alcatel.com.au (mfg1.cim.alcatel.com.au [139.188.23.1]) by netau1.alcanet.com.au (8.9.3 (PHNE_22672)/8.9.3) with ESMTP id QAA25906 for ; Mon, 5 Nov 2001 16:17:26 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37645) with ESMTP id <01KACNFD2U342FHVJ1@cim.alcatel.com.au> for FreeBSD-gnats-submit@freebsd.org; Mon, 5 Nov 2001 16:17:11 +1100 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.1/8.11.1) id fA55HJ971417 for FreeBSD-gnats-submit@freebsd.org; Mon, 05 Nov 2001 16:17:19 +1100 Message-Id: <20011105161719.B94635@gsmx07.alcatel.com.au> Date: Mon, 05 Nov 2001 16:17:19 +1100 From: peter.jeremy@alcatel.com.au To: FreeBSD-gnats-submit@freebsd.org Subject: bin/31764: gamma(3) man page incorrect 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 >Number: 31764 >Category: bin >Synopsis: gamma(3) man page incorrect >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Sun Nov 04 21:20:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Peter Jeremy >Release: FreeBSD 4.4-STABLE i386 >Organization: Alcatel Australia Limited >Environment: System: FreeBSD cirb503493.alcatel.com.au 4.4-STABLE FreeBSD 4.4-STABLE #10: Sat Oct 20 18:35:46 EST 2001 root@cirb503493.alcatel.com.au:/usr/obj/usr/src/sys/pj1592 i386 >Description: The gamma(3) man page states that gamma(x) is gamma(x), whilst lgamma(x) returns ln(gamma(x)). gamma(x) actually returns the log of gamma(x). >How-To-Repeat: #include #include int main() { double d; for (d = 1; d < 10; d++) { printf("gamma(%f) = %f\n", d, gamma(d)); } } If the man page was correct, this program would return: gamma(1.000000) = 1.000000 gamma(2.000000) = 1.000000 gamma(3.000000) = 2.000000 gamma(4.000000) = 6.000000 gamma(5.000000) = 24.000000 gamma(6.000000) = 120.000000 gamma(7.000000) = 720.000000 gamma(8.000000) = 40320.000000 gamma(9.000000) = 362880.000000 It actually returns: gamma(1.000000) = 0.000000 gamma(2.000000) = 0.000000 gamma(3.000000) = 0.693147 gamma(4.000000) = 1.791759 gamma(5.000000) = 3.178054 gamma(6.000000) = 4.787492 gamma(7.000000) = 6.579251 gamma(8.000000) = 8.525161 gamma(9.000000) = 10.604603 >Fix: The standard seems to be that gamma() actually return log gamma(), therefore the implementation is correct, it's just the man page that is wrong. That said, there are two implementations of gamma provided: src/lib/libm/common_source/gamma.c appears to match the man page, whilst src/lib/msun/src/w_gamma.c is the one in libm. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message