Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Feb 2003 13:46:44 -0700
From:      Ben Mesander <ben@timing.com>
To:        freebsd-standards@freebsd.org
Subject:   proposed patch to math.h & lgamma(3) manpage
Message-ID:  <15937.30772.290602.974328@piglet.timing.com>

next in thread | raw e-mail | index | archive | help
Hi,

  A week or so ago I mentioned I was interested in doing a patch to resolve
some issues with math.h & the lgamma(3) man page. In summary:

- gamma_r, lgamma_r, gammaf_r, and lgammaf_r were protected by _REENTRANT
  in math.h; the consensus here was that __BSD_VISIBLE was correct instead.

- gamma_r, lgamma_r, gammaf_r, and lgammaf_r had no documentation in the
  lgamma(3) manpage.

Here is my proposed patch. Let me know what you think. 

Regards,
Ben

--- lib/msun/src/math.h.old	Fri Jan 31 18:01:51 2003
+++ lib/msun/src/math.h	Fri Jan 31 16:04:03 2003
@@ -202,10 +202,10 @@
  * Reentrant version of gamma & lgamma; passes signgam back by reference
  * as the second argument; user must allocate space for signgam.
  */
-#ifdef _REENTRANT
+#ifdef __BSD_VISIBLE
 double	gamma_r(double, int *);
 double	lgamma_r(double, int *);
-#endif /* _REENTRANT */
+#endif /* __BSD_VISIBLE */
 
 /* float versions of ANSI/POSIX functions */
 float	acosf(float);
@@ -284,10 +284,10 @@
  * signgam back by reference as the second argument; user must
  * allocate space for signgam.
  */
-#ifdef _REENTRANT
+#ifdef __BSD_VISIBLE
 float	gammaf_r(float, int *);
 float	lgammaf_r(float, int *);
-#endif	/* _REENTRANT */
+#endif	/* __BSD_VISIBLE */
 
 #endif /* !_XOPEN_SOURCE */
 #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */

--- lib/msun/man/lgamma.3.old	Fri Jan 31 18:02:26 2003
+++ lib/msun/man/lgamma.3	Fri Jan 31 15:57:27 2003
@@ -37,9 +37,13 @@
 .Os
 .Sh NAME
 .Nm lgamma ,
+.Nm lgamma_r ,
 .Nm lgammaf ,
+.Nm lgammaf_r ,
 .Nm gamma ,
+.Nm gamma_r ,
 .Nm gammaf ,
+.Nm gammaf_r ,
 .Nm tgamma
 .Nd log gamma functions, gamma function
 .Sh LIBRARY
@@ -51,12 +55,20 @@
 .sp
 .Ft double
 .Fn lgamma "double x"
+.Ft double
+.Fn lgamma_r "double x, int *signgamp"
 .Ft float
 .Fn lgammaf "float x"
+.Ft float
+.Fn lgammaf_r "float x, int *signgamp"
 .Ft double
 .Fn gamma "double x"
+.Ft double
+.Fn gamma_r "double x, int *signgamp"
 .Ft float
 .Fn gammaf "float x"
+.Ft float
+.Fn gammaf_r "float x, int *signgamp"
 .Ft double
 .Fn tgamma "double x"
 .Sh DESCRIPTION
@@ -78,13 +90,26 @@
 .Fa signgam
 returns the sign of \(*G(x).
 .Pp
-.Fn gamma
+.Fn lgamma_r x signgamp
 and
-.Fn gammaf
-are deprecated aliases for
-.Fn lgamma
+.Fn lgammaf_r x signgamp
+provide the same functionality as
+.Fn lgamma x
+and
+.Fn lgammaf x
+but the caller must provide an integer to store the sign of \(*G(x)
+.Pp
+.Fn gamma ,
+.Fn gammaf ,
+.Fn gamma_r ,
 and
+.Fn gammaf_r
+are deprecated aliases for
+.Fn lgamma ,
 .Fn lgammaf ,
+.Fn lgamma_r ,
+and
+.Fn lgammaf_r ,
 respectively.
 .Fn tgamma x
 returns \(*G(x), with no effect on
@@ -113,10 +138,14 @@
 will lose up to 10 significant bits.
 .Sh RETURN VALUES
 .Fn gamma ,
+.Fn gamma_r,
 .Fn gammaf ,
+.Fn gammaf_r ,
 .Fn lgamma ,
+.Fn lgamma_r ,
+.Fn lgammaf,
 and
-.Fn lgammaf
+.Fn lgammaf_r
 return appropriate values unless an argument is out of range.
 Overflow will occur for sufficiently large positive values, and
 non-positive integers.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-standards" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15937.30772.290602.974328>