man-pages/man3/gamma.3.html
2021-03-31 01:06:50 +01:00

224 lines
5.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of GAMMA</TITLE>
</HEAD><BODY>
<H1>GAMMA</H1>
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
gamma, gammaf, gammal - (logarithm of the) gamma function
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>#include &lt;<A HREF="file:///usr/include/math.h">math.h</A>&gt;</B>
<P>
<B>double gamma(double </B><I>x</I><B>);</B>
<BR>
<B>float gammaf(float </B><I>x</I><B>);</B>
<BR>
<B>long double gammal(long double </B><I>x</I><B>);</B>
<P>
Link with <I>-lm</I>.
<P>
Feature Test Macro Requirements for glibc (see
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
<P>
<B>gamma</B>():
<DL COMPACT><DT id="1"><DD>
_XOPEN_SOURCE
<BR>&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;/*&nbsp;Since&nbsp;glibc&nbsp;2.19:&nbsp;*/&nbsp;_DEFAULT_SOURCE
<BR>&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;/*&nbsp;Glibc&nbsp;versions&nbsp;&lt;=&nbsp;2.19:&nbsp;*/&nbsp;_BSD_SOURCE&nbsp;||&nbsp;_SVID_SOURCE
</DL>
<B>gammaf</B>(),
<B>gammal</B>():
<DL COMPACT><DT id="2"><DD>
_XOPEN_SOURCE &gt;= 600 || (_XOPEN_SOURCE &amp;&amp; _ISOC99_SOURCE)
<BR>&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;/*&nbsp;Since&nbsp;glibc&nbsp;2.19:&nbsp;*/&nbsp;_DEFAULT_SOURCE
<BR>&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;/*&nbsp;Glibc&nbsp;versions&nbsp;&lt;=&nbsp;2.19:&nbsp;*/&nbsp;_BSD_SOURCE&nbsp;||&nbsp;_SVID_SOURCE
</DL>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
These functions are deprecated: instead, use either the
<B><A HREF="/cgi-bin/man/man2html?3+tgamma">tgamma</A></B>(3)
or the
<B><A HREF="/cgi-bin/man/man2html?3+lgamma">lgamma</A></B>(3)
functions, as appropriate.
<P>
For the definition of the Gamma function, see
<B><A HREF="/cgi-bin/man/man2html?3+tgamma">tgamma</A></B>(3).
<A NAME="lbAE">&nbsp;</A>
<H3>*BSD version</H3>
The libm in 4.4BSD and some versions of FreeBSD had a
<B>gamma</B>()
function that computes the Gamma function, as one would expect.
<A NAME="lbAF">&nbsp;</A>
<H3>glibc version</H3>
Glibc has a
<B>gamma</B>()
function that is equivalent to
<B><A HREF="/cgi-bin/man/man2html?3+lgamma">lgamma</A></B>(3)
and computes the natural logarithm of the Gamma function.
<A NAME="lbAG">&nbsp;</A>
<H2>RETURN VALUE</H2>
See
<B><A HREF="/cgi-bin/man/man2html?3+lgamma">lgamma</A></B>(3).
<A NAME="lbAH">&nbsp;</A>
<H2>ERRORS</H2>
See
<B><A HREF="/cgi-bin/man/man2html?3+lgamma">lgamma</A></B>(3).
<A NAME="lbAI">&nbsp;</A>
<H2>ATTRIBUTES</H2>
For an explanation of the terms used in this section, see
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
<TABLE BORDER>
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
<TR VALIGN=top><TD>
<B>gamma</B>(),
<B>gammaf</B>(),
<B>gammal</B>()
</TD><TD>Thread safety</TD><TD>MT-Unsafe race:signgam<BR></TD></TR>
</TABLE>
<A NAME="lbAJ">&nbsp;</A>
<H2>CONFORMING TO</H2>
Because of historical variations in behavior across systems,
this function is not specified in any recent standard.
It was documented in SVID 2.
<A NAME="lbAK">&nbsp;</A>
<H2>NOTES</H2>
<A NAME="lbAL">&nbsp;</A>
<H3>History</H3>
4.2BSD had a
<B>gamma</B>()
that computed
ln(|Gamma(|<I>x</I>|)|),
leaving the sign of
Gamma(|<I>x</I>|)
in the external integer
<I>signgam</I>.
In 4.3BSD the name was changed to
<B><A HREF="/cgi-bin/man/man2html?3+lgamma">lgamma</A></B>(3),
and the man page promises
<P>
&quot;At some time in the future the name gamma will be rehabilitated
and used for the Gamma function&quot;
<P>
This did indeed happen in 4.4BSD, where
<B>gamma</B>()
computes the Gamma function (with no effect on
<I>signgam</I>).
However, this came too late, and we now have
<B><A HREF="/cgi-bin/man/man2html?3+tgamma">tgamma</A></B>(3),
the &quot;true gamma&quot; function.
<A NAME="lbAM">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+lgamma">lgamma</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+signgam">signgam</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+tgamma">tgamma</A></B>(3)
<A NAME="lbAN">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="3"><A HREF="#lbAB">NAME</A><DD>
<DT id="4"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="5"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DL>
<DT id="6"><A HREF="#lbAE">*BSD version</A><DD>
<DT id="7"><A HREF="#lbAF">glibc version</A><DD>
</DL>
<DT id="8"><A HREF="#lbAG">RETURN VALUE</A><DD>
<DT id="9"><A HREF="#lbAH">ERRORS</A><DD>
<DT id="10"><A HREF="#lbAI">ATTRIBUTES</A><DD>
<DT id="11"><A HREF="#lbAJ">CONFORMING TO</A><DD>
<DT id="12"><A HREF="#lbAK">NOTES</A><DD>
<DL>
<DT id="13"><A HREF="#lbAL">History</A><DD>
</DL>
<DT id="14"><A HREF="#lbAM">SEE ALSO</A><DD>
<DT id="15"><A HREF="#lbAN">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:44 GMT, March 31, 2021
</BODY>
</HTML>