>From 765db7b7714514780b4e613c6d09d2ff454b1ef8 Mon Sep 17 00:00:00 2001 From: Harms <wharms@xxxxxx> Date: Wed, 19 May 2021 22:25:08 +0200 Subject: [PATCH] gamma.3:Add reentrant functions gamma_r Add three variants of gamma_r and explain the use of the second argument sig Signed-off-by: Harms <wharms@xxxxxx> --- V2: - fix long lines - fix typo man3/gamma.3 | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/man3/gamma.3 b/man3/gamma.3 index 003964158..7b3425fc2 100644 --- a/man3/gamma.3 +++ b/man3/gamma.3 @@ -1,5 +1,5 @@ .\" Copyright 2002 Walter Harms (walter.harms@xxxxxxxxxxxxxxxxxxxxxxxxxxx) -.\" +.\"-*- mode:nroff-mode ; mode:visual-line -80- .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE) .\" Distributed under GPL .\" %%%LICENSE_END @@ -8,7 +8,8 @@ .\" .TH GAMMA 3 2021-03-22 "GNU" "Linux Programmer's Manual" .SH NAME -gamma, gammaf, gammal \- (logarithm of the) gamma function +gamma, gammaf, gammal, gamma_r, gammaf_r, gammal_r \- (logarithm of the) gamma +function .SH SYNOPSIS .nf .B #include <math.h> @@ -16,7 +17,13 @@ gamma, gammaf, gammal \- (logarithm of the) gamma function .BI "double gamma(double " x ");" .BI "float gammaf(float " x ");" .BI "long double gammal(long double " x ");" -.fi +.PP +.BI "double gamma_r (double " x ", int *" sig ");" +.BI "float gammaf_r(float " x ", int *" sig ");" +.BI "long double gammal_r(long double " x ", int *" sig ");" +.PP +.BI "extern int " signgam ; +.fi. .PP Link with \fI\-lm\fP. .PP @@ -46,6 +53,16 @@ or the .BR lgamma (3) functions, as appropriate. .PP +The functions with the "_r" suffix are the reentrant version +of the corresponding function. The sign of the intermediate gamma +function is stored in the variable pointed to by +.IR sig . +The real gamma function can be computed as: +.PP +.RS +gam = sig * exp(gamma(x)); +.RE +.PP For the definition of the Gamma function, see .BR tgamma (3). .SS *BSD version -- 2.26.2