Skip to content

foresight_gammafun ​

gnuplot 6.0.0's error, gamma, incomplete gamma, incomplete beta and normal distribution functions.

Ported from gnuplot 6.0.0 specfun.c (Cephes ndtri, incbet, igamc, the inverse functions) and complexfun.c (Igamma, lnGamma), with gnuplot's coefficients, branch points and operation order, so that the values match the installed gnuplot (Linux, glibc 2.39) to the last digit.

Every entry point gp_<name> takes gnuplot's arguments in gnuplot's order and returns r and status: 0 the value is in r; 1 gnuplot's undefined value ("undefined value", a gap in a plot); 2 a gnuplot error, which no function of this family ever raises. gnuplot flags a result undefined when a libm call leaves errno at EDOM or ERANGE (eval.c evaluate_at), even when the value is meaningful (igamma(1, 800)): that errno is tracked here. All results are real (gnuplot prints 1.0, not 1). A NaN in r with status 0 is gnuplot's printed NaN (its overflowing continued fractions and Halley steps end there). Where gnuplot's result is infinite (huge or tiny arguments, see each docstring) status is 1 instead. Every operation that could overflow, divide by zero or be invalid is guarded, so no finite argument raises an IEEE exception other than underflow and inexact.

gnuplot calls glibc's erf, erfc, tgamma, lgamma, exp, log, pow, sin, cos: the Fortran intrinsics, which are glibc's under gfortran. glibc's complex clog and cexp are emulated (clog uses log1p for moduli in [0.5, 2), ported from glibc's FMA build, the one this machine's glibc dispatches).

Source: src/lib/foresight_gammafun.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
DBL_MAXreal(kind=R8P)parameterC DBL_MAX.
DBL_MINreal(kind=R8P)parameterC DBL_MIN.
MACHEPreal(kind=R8P)parameterCephes MACHEP = DBL_EPSILON.
MAXLOGreal(kind=R8P)parameterCephes MAXLOG, log(2**1022).
MINLOGreal(kind=R8P)parameterCephes MINLOG.
MAXGAMreal(kind=R8P)parameterCephes MAXGAM.
BIGreal(kind=R8P)parameterCephes incbet big.
BIGINVreal(kind=R8P)parameterCephes incbet biginv.
IGAMMA_PRECISIONreal(kind=R8P)parametergnuplot IGAMMA_PRECISION.
FLT_MAXreal(kind=R8P)parameterC FLT_MAX (IGAMMA_OVERFLOW).
VERYLARGEreal(kind=R8P)parametergnuplot VERYLARGE, DBL_MAX/2-1.
PIreal(kind=R8P)parametergnuplot PI and M_PI.
SQRT_TWOreal(kind=R8P)parametergnuplot SQRT_TWO.
LN2real(kind=R8P)parameterglibc M_LN2.
ZERO_TOLreal(kind=R8P)parametergnuplot set zero: plotted if |imag| <= it.
EXP_ZEROreal(kind=R8P)parameterglibc exp(x) is 0 (and ERANGE) iff x <= it.
EXP_INFreal(kind=R8P)parameterglibc exp(x) overflows (ERANGE) iff x > it.
TGAMMA_MAXreal(kind=R8P)parameterglibc tgamma(x) overflows iff x > it.
INV_TINY_BITSinteger(kind=I8P)parameterBits of the least x with 1/x finite, 5.56e-309: also glibc tgamma's overflow threshold near 0.
LGAMMA_MAXreal(kind=R8P)parameterglibc lgamma(x) overflows iff x > it.
ERFC_ZEROreal(kind=R8P)parameterglibc erfc(x) is 0 (and ERANGE) iff x >= it.
LOG_HALF_DENORMreal(kind=R8P)parameterlog(2**-1075): tgamma rounds to 0 below it.
S2PIreal(kind=R8P)parameterndtri's sqrt(2pi).
LANCZOS_SQRT2PIreal(kind=R8P)parametercomplexfun.c lnGamma sqrt2pi.
LANCZOS_Greal(kind=R8P)parametercomplexfun.c lnGamma g.
LANCZOSreal(kind=R8P)parametercomplexfun.c lnGamma 14 term Lanczos coef.
GL_Yreal(kind=R8P)parameterIgamma_GL Gauss-Legendre abscissae.
GL_Wreal(kind=R8P)parameterIgamma_GL Gauss-Legendre weights.
NDTRI_P0real(kind=R8P)parameterndtri P0, 0 <= |y - 0.5| <= 3/8.
NDTRI_Q0real(kind=R8P)parameterndtri Q0 (leading 1 omitted).
NDTRI_P1real(kind=R8P)parameterndtri P1, z = sqrt(-2 log y) in [2, 8].
NDTRI_Q1real(kind=R8P)parameterndtri Q1 (leading 1 omitted).
NDTRI_P2real(kind=R8P)parameterndtri P2, z = sqrt(-2 log y) in [8, 64].
NDTRI_Q2real(kind=R8P)parameterndtri Q2 (leading 1 omitted).
INVERF_Areal(kind=R8P)parameterinverse_error_func a[].
INVERF_Breal(kind=R8P)parameterinverse_error_func b[].
INVERF_Creal(kind=R8P)parameterinverse_error_func c[].
INVERF_Dreal(kind=R8P)parameterinverse_error_func d[].
L1P_LN2_HIreal(kind=R8P)parameterglibc log1p ln2_hi.
L1P_LN2_LOreal(kind=R8P)parameterglibc log1p ln2_lo.
L1P_LPreal(kind=R8P)parameterglibc log1p Lp1..Lp7.

Subroutines ​

gp_erf ​

gnuplot erf(x) (specfun.c f_erf): libm erf. Real result, always defined.

Attributes: pure

fortran
subroutine gp_erf(x, r, status)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inArgument.
rreal(kind=R8P)outerf(x).
statusinteger(kind=I4P)out0 (always defined).

Call graph

gp_erfc ​

gnuplot erfc(x) (specfun.c f_erfc): libm erfc. Real result; undefined when glibc's erfc underflows to 0 (x >= 27.2263641357421875), since glibc then sets ERANGE.

Attributes: pure

fortran
subroutine gp_erfc(x, r, status)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inArgument.
rreal(kind=R8P)outerfc(x).
statusinteger(kind=I4P)out0 defined, 1 undefined.

Call graph

gp_gamma ​

gnuplot gamma(x) (specfun.c f_gamma): libm tgamma. Real result; undefined where glibc's tgamma sets errno: at 0 and the negative integers, on overflow (x > 171.62437695630271, |x| < 5.56e-309) and when the result underflows to 0 (x < -184 or so, judged by lgamma so that a flush-to-zero build agrees).

Attributes: pure

fortran
subroutine gp_gamma(x, r, status)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inArgument.
rreal(kind=R8P)outGamma(x).
statusinteger(kind=I4P)out0 defined, 1 undefined.

Call graph

gp_lgamma ​

gnuplot lgamma(x) (specfun.c f_lgamma): libm lgamma, ln|Gamma(x)| (no sign: lgamma(-0.5) = 1.2655 > 0 while Gamma(-0.5) < 0). Real result; undefined at 0 and the negative integers (poles) and for x > 2.5599833278516383e305 (overflow), where glibc sets ERANGE.

Attributes: pure

fortran
subroutine gp_lgamma(x, r, status)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inArgument.
rreal(kind=R8P)outln|Gamma(x)|.
statusinteger(kind=I4P)out0 defined, 1 undefined.

Call graph

gp_norm ​

gnuplot norm(x) (specfun.c f_normal): 0.5 erfc(-x/sqrt(2)) for x > -38, else 0. Real result, always defined.

Attributes: pure

fortran
subroutine gp_norm(x, r, status)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inArgument.
rreal(kind=R8P)outNormal cumulative distribution at x.
statusinteger(kind=I4P)out0 (always defined).

Call graph

gp_invnorm ​

gnuplot invnorm(x) (specfun.c f_inverse_normal, Cephes ndtri). Real result; undefined for x <= 0 or x >= 1.

Attributes: pure

fortran
subroutine gp_invnorm(x, r, status)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inProbability.
rreal(kind=R8P)outNormal quantile.
statusinteger(kind=I4P)out0 defined, 1 undefined.

Call graph

gp_inverf ​

gnuplot inverf(x) (specfun.c f_inverse_erf, inverse_error_func: NIST rational guess and 4 Newton steps, with gnuplot's b[3] * z + b[3] typo kept). Real result; undefined for |x| >= 1.

Attributes: pure

fortran
subroutine gp_inverf(x, r, status)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inArgument in (-1, 1).
rreal(kind=R8P)outInverse error function.
statusinteger(kind=I4P)out0 defined, 1 undefined.

Call graph

gp_igamma ​

gnuplot igamma(a, x), the regularized lower incomplete gamma P(a, x): gnuplot 6.0 built with complex functions evaluates complexfun.c Igamma (AS239 series and continued fraction, Gauss-Legendre for large a, A&S 6.5.29 for x < 0), not specfun.c's real igamma. Real result for x >= 0; for x < 0 gnuplot returns a complex value: r is its real part, ri its imaginary part (for gnuplot's sampled x, imaginary part +0), and status is 1 when |imag| > 1e-8, as gnuplot's plot (set zero). a <= 0, or no convergence / overflow of the continued fraction (gnuplot warns "Igamma: overflow" or "Igamma: no convergence after %d iterations residual %g"): NaN, status 0, unless errno is set. Undefined (status 1) when glibc's cexp underflows to 0 in the continued fraction or the Gauss-Legendre sum (e.g. igamma(1, 800), igamma(1e6, 1.1e6)), and where gnuplot's result is infinite (x < 0 with |x| beyond a few hundred, a beyond 1e300).

Attributes: pure

fortran
subroutine gp_igamma(a, x, r, status, ri)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShape, a > 0.
xreal(kind=R8P)inUpper limit.
rreal(kind=R8P)outP(a, x), real part.
statusinteger(kind=I4P)out0 defined, 1 undefined.
rireal(kind=R8P)outoptionalImaginary part (nonzero only for x < 0).

Call graph

gp_uigamma ​

gnuplot uigamma(a, x), the regularized upper incomplete gamma Q(a, x) (specfun.c f_uigamma, Cephes igamc: for x < 1 or x < a 1 - igamma(a, x) with complexfun.c's igamma, so 2 when that fails). Real result; undefined for x < 0 or a <= 0 and when errno is set (as in igamma, or glibc's lgamma(a) overflowing, a > 2.56e305); NaN (status 0) where gnuplot's continued fraction overflows (a, x beyond about 1e154).

Attributes: pure

fortran
subroutine gp_uigamma(a, x, r, status)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShape, a > 0.
xreal(kind=R8P)inLower limit, x >= 0.
rreal(kind=R8P)outQ(a, x).
statusinteger(kind=I4P)out0 defined, 1 undefined.

Call graph

gp_invigamma ​

gnuplot invigamma(a, p) (specfun.c f_inverse_igamma, inverse_incomplete_gamma: A&S or NR initial guess, 12 Halley steps on complexfun.c's igamma). Real result: 0 for p = 0, max(100, a + 100 sqrt(a)) for p = 1. Undefined for a <= 0 (gnuplot warns "invigamma: a<=0 invalid"), p < 0 or p > 1 ("invigamma: p invalid"), and when errno is set during the iteration (gnuplot warns inverse_incomplete_gamma: <strerror>... and gives NaN). NaN (status 0) when a Halley step overflows (huge a).

Attributes: pure

fortran
subroutine gp_invigamma(a, p, r, status)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShape, a > 0.
preal(kind=R8P)inProbability in [0, 1].
rreal(kind=R8P)outx such that igamma(a, x) = p.
statusinteger(kind=I4P)out0 defined, 1 undefined.

Call graph

gp_ibeta ​

gnuplot ibeta(a, b, x), the regularized incomplete beta I_x(a, b) (specfun.c f_ibeta with Cephes incbet: power series or one of two continued fractions). Real result; undefined for a <= 0, b <= 0, x outside [0, 1], when glibc's tgamma or lgamma overflow (a or b below 5.56e-309, a + b above 2.56e305) and where gnuplot's power series returns inf (a below 5.56e-309 with a + b >= 171.6); NaN (status 0) where gnuplot's continued fractions overflow (a, b beyond about 1e150).

Attributes: pure

fortran
subroutine gp_ibeta(a, b, x, r, status)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShape a > 0.
breal(kind=R8P)inShape b > 0.
xreal(kind=R8P)inUpper limit in [0, 1].
rreal(kind=R8P)outI_x(a, b).
statusinteger(kind=I4P)out0 defined, 1 undefined.

Call graph

gp_invibeta ​

gnuplot invibeta(a, b, p) (specfun.c f_inverse_ibeta, inverse_incomplete_beta: A&S 26.5.22 or NR 6.4.8 initial guess, 12 Halley steps on incbet). Real result: NaN for a <= 0 or b <= 0 (status 0, gnuplot prints NaN), 0 for p <= 0, 1 for |1 - p| < 1e-14; p outside [0, 1] is only warned ("f_inverse_ibeta: p %g not in domain") and computed. Undefined when errno is set: gnuplot's guess takes sqrt(z) of a negative normal deviate, so for a >= 1 and b >= 1 every p < 0.5 is undefined (invibeta(2, 2, 0.1)), as in gnuplot 6.0.0. NaN (status 0) when a Halley step overflows.

Attributes: pure

fortran
subroutine gp_invibeta(a, b, p, r, status)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShape a > 0.
breal(kind=R8P)inShape b > 0.
preal(kind=R8P)inProbability.
rreal(kind=R8P)outx such that ibeta(a, b, x) = p.
statusinteger(kind=I4P)out0 defined, 1 undefined.

Call graph

cexp_ ​

glibc's cexp(u + i w) for finite u, w: exp(u) (cos w, sin w), scaled by exp(709) above 709; errno when exp(u) underflows to 0; ovf when the result overflows (gnuplot then holds infinities).

Attributes: pure

fortran
subroutine cexp_(u, w, cr, ci, errno, ovf)

Arguments

NameTypeIntentAttributesDescription
ureal(kind=R8P)inReal and imaginary parts of the argument.
wreal(kind=R8P)inReal and imaginary parts of the argument.
crreal(kind=R8P)outResult.
cireal(kind=R8P)outResult.
errnologicalinouterrno.
ovflogicaloutOverflow.

Call graph

pow_ ​

glibc's pow(x, y): negative x only for integer y (else NaN and EDOM), errno on overflow and on underflow to 0.

Attributes: pure

fortran
subroutine pow_(x, y, r, errno, ovf)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)valueBase and exponent (by value: r may be one of them).
yreal(kind=R8P)valueBase and exponent (by value: r may be one of them).
rreal(kind=R8P)inoutx**y (inout: see mul_).
errnologicalinouterrno.
ovflogicaloutOverflow (r is then +-huge).

Call graph

pow_inf ​

glibc's pow(x, +inf): 0 for |x| < 1, 1 for |x| = 1, +inf (ovf) above, without errno.

Attributes: pure

fortran
subroutine pow_inf(x, r, ovf)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)valueBase (by value: r may be it).
rreal(kind=R8P)inoutpow(x, +inf) (inout: see mul_).
ovflogicalout+inf result.

Call graph

exp_ ​

glibc's exp(x): errno on overflow and on underflow to 0.

Attributes: pure

fortran
subroutine exp_(x, r, errno, ovf)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inArgument.
rreal(kind=R8P)outexp(x).
errnologicalinouterrno.
ovflogicaloutOverflow (r is then huge).

Call graph

lgamma_ ​

glibc's lgamma(x) for x > 0: ERANGE (and a huge value) on overflow.

Attributes: pure

fortran
subroutine lgamma_(x, r, errno)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inArgument, positive.
rreal(kind=R8P)outln Gamma(x).
errnologicalinouterrno.

Call graph

mul_ ​

r = a * b; bad set (and r = 0) when the product overflows.

Attributes: pure

fortran
subroutine mul_(a, b, r, bad)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)valueFactors (by value: r may be one of them).
breal(kind=R8P)valueFactors (by value: r may be one of them).
rreal(kind=R8P)inouta * b (inout, not out: gfortran clobbers an intent(out) actual that is also a value actual of the same call before reading it).
badlogicalinoutOverflow flag.

Call graph

add_ ​

r = a + b; bad set (and r = 0) when the sum overflows.

Attributes: pure

fortran
subroutine add_(a, b, r, bad)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)valueAddends (by value: r may be one of them).
breal(kind=R8P)valueAddends (by value: r may be one of them).
rreal(kind=R8P)inouta + b (inout: see mul_).
badlogicalinoutOverflow flag.

Call graph

div_ ​

r = a / b; bad set (and r = 0) when b is 0 or the quotient overflows.

Attributes: pure

fortran
subroutine div_(a, b, r, bad)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)valueDividend and divisor (by value: r may be one of them).
breal(kind=R8P)valueDividend and divisor (by value: r may be one of them).
rreal(kind=R8P)inouta / b (inout: see mul_).
badlogicalinoutOverflow flag.

Call graph

ratio_ ​

r = (a b) / (c d) as C evaluates it: 0 when only c d overflows (finite / inf), bad when a b overflows.

Attributes: pure

fortran
subroutine ratio_(a, b, c, d, r, bad)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inOperands.
breal(kind=R8P)inOperands.
creal(kind=R8P)inOperands.
dreal(kind=R8P)inOperands.
rreal(kind=R8P)out(a b) / (c d).
badlogicalinoutOverflow flag.

Call graph

lngamma_lanczos ​

complexfun.c lnGamma for real z > 0 (14 term Lanczos, glibc clog); ok false when gnuplot gets +inf.

Attributes: pure

fortran
subroutine lngamma_lanczos(z, f, ok)

Arguments

NameTypeIntentAttributesDescription
zreal(kind=R8P)inArgument, positive.
freal(kind=R8P)outln Gamma(z).
oklogicaloutFinite result.

Call graph

igamma_core ​

complexfun.c Igamma(a, z) for real a > 0 and real z /= 0 (imaginary parts +0). Outcomes: a value in re, im; fail, Igamma's -1 (overflow or no convergence); nanres, a NaN; bad, an infinite value.

Attributes: pure

fortran
subroutine igamma_core(a, z, re, im, fail, nanres, errno, bad)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShape, positive.
zreal(kind=R8P)inArgument, nonzero.
rereal(kind=R8P)outResult.
imreal(kind=R8P)outResult.
faillogicaloutIgamma returned -1 (overflow or no convergence).
nanreslogicaloutIgamma returned NaN.
errnologicalinouterrno (cleared on entry, as Igamma does).
badlogicaloutIgamma returned an infinity.

Call graph

igamma_gl ​

complexfun.c Igamma_GL, 18 point Gauss-Legendre quadrature, for real a > 100 and real z > 0.

Attributes: pure

fortran
subroutine igamma_gl(a, z, re, nanres, errno, bad)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShape.
zreal(kind=R8P)inArgument.
rereal(kind=R8P)outResult.
nanreslogicaloutNaN result.
errnologicalinouterrno.
badlogicaloutInfinite result.

Call graph

igamma_negative_z ​

complexfun.c Igamma_negative_z (A&S 6.5.29), for real 0 < a < 75 and real z < 0 (imaginary part +0).

Attributes: pure

fortran
subroutine igamma_negative_z(a, z, re, im, fail, errno, bad)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShape.
zreal(kind=R8P)inArgument, negative.
rereal(kind=R8P)outResult.
imreal(kind=R8P)outResult.
faillogicaloutOverflow (gnuplot returns -1).
errnologicalinouterrno.
badlogicaloutgnuplot's result is not finite.

Call graph

igamma_re ​

complexfun.c igamma(a, z) wrapper, creal(Igamma(a, z)), for real a > 0 and z >= 0 (-1 when Igamma fails).

Attributes: pure

fortran
subroutine igamma_re(a, z, re, fail, nanres, errno, bad)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShape.
zreal(kind=R8P)inArgument.
rereal(kind=R8P)outReal part.
faillogicaloutIgamma returned -1 (re is -1).
nanreslogicaloutIgamma returned NaN.
errnologicalinouterrno.
badlogicaloutIgamma returned an infinity.

Call graph

igamc ​

specfun.c igamc (Cephes), the complemented incomplete gamma, for a > 0 and x >= 0.

Attributes: pure

fortran
subroutine igamc(a, x, r, status)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShape.
xreal(kind=R8P)inArgument.
rreal(kind=R8P)outQ(a, x).
statusinteger(kind=I4P)out0 defined, 1 undefined.

Call graph

inverse_incomplete_gamma ​

specfun.c inverse_incomplete_gamma, Halley's method on igamma, for a > 0 and 0 < p < 1.

Attributes: pure

fortran
subroutine inverse_incomplete_gamma(a, p, z, status)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShape.
preal(kind=R8P)inProbability.
zreal(kind=R8P)outRoot.
statusinteger(kind=I4P)out0 defined, 1 undefined.

Call graph

halley_step ​

gnuplot's Halley step tn = u / (1 - 0.5 min(1, u q)), u = err / t, with C's infinities: t is +inf for tcls 1, q is +-inf for qcls +-1 and NaN for qcls 2. nonfinite when tn is not finite (gnuplot's z then turns NaN).

Attributes: pure

fortran
subroutine halley_step(err, t, tcls, q, qcls, tn, nonfinite)

Arguments

NameTypeIntentAttributesDescription
errreal(kind=R8P)inResidual.
treal(kind=R8P)inDerivative, >= 0.
tclsinteger(kind=I4P)inClass of t: 0 finite, 1 +inf.
qreal(kind=R8P)inSecond order factor.
qclsinteger(kind=I4P)inClass of q: 0 finite, +-1 +-inf, 2 NaN.
tnreal(kind=R8P)outStep.
nonfinitelogicaloutStep not finite.

Call graph

incbet ​

specfun.c incbet (Cephes): -1 for aa <= 0, bb <= 0 or xx outside [0, 1]; bad when gnuplot's result is infinite, nanres when it is NaN (a continued fraction overflowing).

Attributes: pure

fortran
subroutine incbet(aa, bb, xx, t, errno, bad, nanres)

Arguments

NameTypeIntentAttributesDescription
aareal(kind=R8P)inShapes and argument.
bbreal(kind=R8P)inShapes and argument.
xxreal(kind=R8P)inShapes and argument.
treal(kind=R8P)outI_xx(aa, bb).
errnologicalinouterrno.
badlogicaloutInfinite result.
nanreslogicaloutNaN result.

Call graph

incbcf ​

specfun.c incbcf, continued fraction expansion #1 for the incomplete beta integral.

Attributes: pure

fortran
subroutine incbcf(a, b, x, ans, bad)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShapes and argument.
breal(kind=R8P)inShapes and argument.
xreal(kind=R8P)inShapes and argument.
ansreal(kind=R8P)outContinued fraction.
badlogicalinoutOverflow flag.

Call graph

incbd ​

specfun.c incbd, continued fraction expansion #2 for the incomplete beta integral.

Attributes: pure

fortran
subroutine incbd(a, b, x, ans, bad)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShapes and argument.
breal(kind=R8P)inShapes and argument.
xreal(kind=R8P)inShapes and argument.
ansreal(kind=R8P)outContinued fraction.
badlogicalinoutOverflow flag.

Call graph

pseries ​

specfun.c pseries, power series for the incomplete beta integral (b x small, x not near 1).

Attributes: pure

fortran
subroutine pseries(a, b, x, s, errno, bad)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShapes and argument.
breal(kind=R8P)inShapes and argument.
xreal(kind=R8P)inShapes and argument.
sreal(kind=R8P)outSeries value.
errnologicalinouterrno.
badlogicaloutgnuplot's result is not finite.

Call graph

inverse_incomplete_beta ​

specfun.c inverse_incomplete_beta, Halley's method on incbet, for a > 0, b > 0, p > 0, |1 - p| >= 1e-14.

Attributes: pure

fortran
subroutine inverse_incomplete_beta(a, b, p, z, status)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inShapes and probability.
breal(kind=R8P)inShapes and probability.
preal(kind=R8P)inShapes and probability.
zreal(kind=R8P)outRoot.
statusinteger(kind=I4P)out0 defined, 1 undefined.

Call graph

Functions ​

nan ​

Quiet NaN, without raising an exception.

Attributes: pure

Returns: real(kind=R8P)

fortran
function nan() result(r)

Call graph

fma_ ​

a * b + c rounded once (glibc's FMA build); nvfortran has no ieee_fma, -Mnofma leaves a * b + c unfused there.

Attributes: pure

Returns: real(kind=R8P)

fortran
function fma_(a, b, c) result(r)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inOperands.
breal(kind=R8P)inOperands.
creal(kind=R8P)inOperands.

Call graph

inv_overflows ​

1/x overflows (x >= 0): x below 5.5626846462680084e-309, compared on the bits so that flush-to-zero builds (and their denormals-are-zero comparisons) agree.

Attributes: pure

Returns: logical

fortran
function inv_overflows(x) result(ovf)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inNon negative value.

Call graph

high_word ​

High 32 bits of the IEEE representation of x, as glibc's GET_HIGH_WORD.

Attributes: pure

Returns: integer(kind=I4P)

fortran
function high_word(x) result(h)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inValue.

Call graph

with_high_word ​

x with its high 32 bits replaced by h, as glibc's SET_HIGH_WORD.

Attributes: pure

Returns: real(kind=R8P)

fortran
function with_high_word(x, h) result(y)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inValue.
hinteger(kind=I4P)inNew high word (non negative).

Call graph

log1p_glibc ​

glibc 2.39 __log1p_fma (fdlibm s_log1p.c built with FMA contraction), for x > -1.

Attributes: pure

Returns: real(kind=R8P)

fortran
function log1p_glibc(x) result(r)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inArgument.

Call graph

clog_re ​

Real part of glibc's clog(x + 0i), x /= 0: log|x|, through log1p for |x| in [0.5, 2) as glibc does.

Attributes: pure

Returns: real(kind=R8P)

fortran
function clog_re(x) result(r)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inArgument, nonzero.

Call graph

quotient_or_inf ​

|a / b| for b /= 0, huge where C gets inf (the continued fractions' relative change test goes on).

Attributes: pure

Returns: real(kind=R8P)

fortran
function quotient_or_inf(a, b) result(r)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inDividend and nonzero divisor.
breal(kind=R8P)inDividend and nonzero divisor.

Call graph

polevl ​

Cephes polevl: coef(0) x**n + ... + coef(n).

Attributes: pure

Returns: real(kind=R8P)

fortran
function polevl(x, coef, n) result(ans)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inArgument.
coefreal(kind=R8P)inCoefficients, highest degree first.
ninteger(kind=I4P)inDegree.

Call graph

p1evl ​

Cephes p1evl: xn + coef(0) x(n-1) + ... + coef(n-1).

Attributes: pure

Returns: real(kind=R8P)

fortran
function p1evl(x, coef, n) result(ans)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inArgument.
coefreal(kind=R8P)inCoefficients, leading 1 omitted.
ninteger(kind=I4P)inDegree.

Call graph

ndtri ​

specfun.c inverse_normal_func (Cephes ndtri), for 0 < y0 < 1.

Attributes: pure

Returns: real(kind=R8P)

fortran
function ndtri(y0) result(x)

Arguments

NameTypeIntentAttributesDescription
y0real(kind=R8P)inProbability.

Call graph

inverse_error_func ​

specfun.c inverse_error_func, for |y| < 1.

Attributes: pure

Returns: real(kind=R8P)

fortran
function inverse_error_func(y) result(x)

Arguments

NameTypeIntentAttributesDescription
yreal(kind=R8P)inArgument.

Call graph

Released under the GPL v3, BSD 2-Clause, BSD 3-Clause or MIT License.