These are some more exotic mathematical functions which are sometimes useful. Currently they only have real-valued versions.

— Function: double **erf** (`double x`)

— Function: floaterff(float x)

— Function: long doubleerfl(long double x)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

`erf`

returns the error function ofx. The error function is defined aserf (x) = 2/sqrt(pi) * integral from 0 to x of exp(-t^2) dt

— Function: double **erfc** (`double x`)

— Function: floaterfcf(float x)

— Function: long doubleerfcl(long double x)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

`erfc`

returns`1.0 - erf(`

x`)`

, but computed in a fashion that avoids round-off error whenxis large.

— Function: double **lgamma** (`double x`)

— Function: floatlgammaf(float x)

— Function: long doublelgammal(long double x)

Preliminary: | MT-Unsafe race:signgam | AS-Unsafe | AC-Safe | See POSIX Safety Concepts.

`lgamma`

returns the natural logarithm of the absolute value of the gamma function ofx. The gamma function is defined asgamma (x) = integral from 0 to ∞ of t^(x-1) e^-t dtThe sign of the gamma function is stored in the global variable

signgam, which is declared inmath.h. It is`1`

if the intermediate result was positive or zero, or`-1`

if it was negative.To compute the real gamma function you can use the

`tgamma`

function or you can compute the values as follows:lgam = lgamma(x); gam = signgam*exp(lgam);The gamma function has singularities at the non-positive integers.

`lgamma`

will raise the zero divide exception if evaluated at a singularity.

— Function: double **lgamma_r** (`double x, int *signp`)

— Function: floatlgammaf_r(float x, int *signp)

— Function: long doublelgammal_r(long double x, int *signp)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

`lgamma_r`

is just like`lgamma`

, but it stores the sign of the intermediate result in the variable pointed to bysignpinstead of in thesigngamglobal. This means it is reentrant.

— Function: double **gamma** (`double x`)

— Function: floatgammaf(float x)

— Function: long doublegammal(long double x)

Preliminary: | MT-Unsafe race:signgam | AS-Unsafe | AC-Safe | See POSIX Safety Concepts.

These functions exist for compatibility reasons. They are equivalent to

`lgamma`

etc. It is better to use`lgamma`

since for one the name reflects better the actual computation, moreover`lgamma`

is standardized in ISO C99 while`gamma`

is not.

— Function: double **tgamma** (`double x`)

— Function: floattgammaf(float x)

— Function: long doubletgammal(long double x)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

`tgamma`

applies the gamma function tox. The gamma function is defined asgamma (x) = integral from 0 to ∞ of t^(x-1) e^-t dtThis function was introduced in ISO C99.

— Function: double **j0** (`double x`)

— Function: floatj0f(float x)

— Function: long doublej0l(long double x)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

`j0`

returns the Bessel function of the first kind of order 0 ofx. It may signal underflow ifxis too large.

— Function: double **j1** (`double x`)

— Function: floatj1f(float x)

— Function: long doublej1l(long double x)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

`j1`

returns the Bessel function of the first kind of order 1 ofx. It may signal underflow ifxis too large.

— Function: double **jn** (`int n, double x`)

— Function: floatjnf(int n, float x)

— Function: long doublejnl(int n, long double x)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

`jn`

returns the Bessel function of the first kind of ordernofx. It may signal underflow ifxis too large.

— Function: double **y0** (`double x`)

— Function: floaty0f(float x)

— Function: long doubley0l(long double x)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

`y0`

returns the Bessel function of the second kind of order 0 ofx. It may signal underflow ifxis too large. Ifxis negative,`y0`

signals a domain error; if it is zero,`y0`

signals overflow and returns -∞.

— Function: double **y1** (`double x`)

— Function: floaty1f(float x)

— Function: long doubley1l(long double x)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

`y1`

returns the Bessel function of the second kind of order 1 ofx. It may signal underflow ifxis too large. Ifxis negative,`y1`

signals a domain error; if it is zero,`y1`

signals overflow and returns -∞.

— Function: double **yn** (`int n, double x`)

— Function: floatynf(int n, float x)

— Function: long doubleynl(int n, long double x)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

`yn`

returns the Bessel function of the second kind of ordernofx. It may signal underflow ifxis too large. Ifxis negative,`yn`

signals a domain error; if it is zero,`yn`

signals overflow and returns -∞.