NetBSD Problem Report #3917

Received: (qmail 4814 invoked from network); 25 Jul 1997 19:03:50 -0000
Message-Id: <199707251903.VAA00936@ulysses.df.lth.se>
Date: Fri, 25 Jul 1997 21:03:39 +0200 (CEST)
From: Krister Walfridsson <cato@ulysses.df.lth.se>
Reply-To: cato@ulysses.df.lth.se
To: gnats-bugs@gnats.netbsd.org
Subject: gamma(3)/lgamma(3) man page is misleading
X-Send-Pr-Version: 3.95

>Number:         3917
>Category:       lib
>Synopsis:       gamma(3)/lgamma(3) man page is misleading
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 25 12:05:02 +0000 1997
>Closed-Date:    Fri Jul 25 13:38:56 +0000 1997
>Last-Modified:  Fri Jul 25 20:41:22 +0000 1997
>Originator:     Krister Walfridsson
>Release:        NetBSD-current 19 Jul 1997
>Organization:

>Environment:

System: NetBSD ulysses 1.2G NetBSD 1.2G (KWA) #0: Sun Jul 13 16:33:57 MEST 1997 cato@ulysses:/usr/src/sys/arch/sparc/compile/KWA sparc


>Description:
The man page gives the impression that gamma(3) calculates the gamma
function, but our gamma(3) is identical to lgamma(3), which calculates the
logarithm of the gamma function.

>How-To-Repeat:

>Fix:
In 4.4BSD and FreeBSD does gamma(3) actually calculate the gamma function,
so I think the best solution is to inport the 4.4BSD implementation.
If that has too much potential of breakage of existing code etc. do 
something like this to the man page

*** lgamma.3.bak        Sat Mar 30 13:32:09 1996
--- lgamma.3    Fri Jul 25 20:47:45 1997
***************
*** 44,49 ****
--- 44,53 ----
  .Fa signgam ;
  .sp
  .Ft double
+ .Fn gamma "double x"
+ .Ft float
+ .Fn gammaf "float x"
+ .Ft double
  .Fn lgamma "double x"
  .Ft float
  .Fn lgammaf "float x"
***************
*** 64,69 ****
--- 68,77 ----
  .Fa signgam
  returns the sign of \(*G(x).
  .Pp
+ .Fn Gamma
+ is identical to
+ .Fn lgamma
+ .Pp
  .Sh IDIOSYNCRASIES
  Do not use the expression
  .Dq Li signgam\(**exp(lgamma(x))
***************
*** 77,89 ****
  .Fn lgamma
  has returned can signgam be correct.
  .Pp
- For arguments in its range,
- .Fn gamma
- is preferred, as for positive arguments
- it is accurate to within one unit in the last place.
- Exponentiation of
- .Fn lgamma
- will lose up to 10 significant bits.
  .Sh RETURN VALUES
  .Fn Gamma
  and
--- 85,90 ----
***************
*** 98,106 ****
  .Va errno
  is set to
  .Er ERANGE
- For large non-integer negative values,
- .Fn gamma
- will underflow.
  .Sh SEE ALSO
  .Xr math 3
  .Sh HISTORY
--- 99,104 ----

>Release-Note:
>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: jtc
State-Changed-When: Fri Jul 25 13:38:56 1997
State-Changed-Why:
Removed confusing text which implies that gamma() computes the gamma
instead of log gamma function.  This was true with 4.4BSD's libm, but
they are equivalent on all other systems (XPG4.2 requires this).

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.