﻿s14ab Method
s14ab returns the value of the logarithm of the Gamma function, lnΓx.

# Syntax

C#
```public static double s14ab(
double x,
out int ifail
)```
Visual Basic (Declaration)
```Public Shared Function s14ab ( _
x As Double, _
<OutAttribute> ByRef ifail As Integer _
) As Double```
Visual C++
```public:
static double s14ab(
double x,
[OutAttribute] int% ifail
)```
F#
```static member s14ab :
x:float *
ifail:int byref -> float
```

#### Parameters

x
Type: System..::.Double
On entry: the argument x of the function.
Constraint: x>0.0.
ifail
Type: System..::.Int32 %
On exit: ifail=0 unless the method detects an error (see [Error Indicators and Warnings]).

#### Return Value

s14ab returns the value of the logarithm of the Gamma function, lnΓx.

# Description

s14ab calculates an approximate value for lnΓx. It is based on rational Chebyshev expansions.
Denote by Rn,mix=Pnix/Qmix a ratio of polynomials of degree n in the numerator and m in the denominator. Then:
Let ε denote machine precision and let xhuge denote the largest positive model number (see x02al). For x<0.0 the value lnΓx is not defined; s14ab returns zero and exits with ifail=1. It also exits with ifail=1 when x=0.0, and in this case the value xhuge is returned. For x in the interval 0.0,ε, the function lnΓx=-lnx to machine accuracy.
Now denote by xbig the largest allowable argument for lnΓx on the machine. For xbig1/4<xxbig the Rn,m41/x2 term in Equation (1) is negligible. For x>xbig there is a danger of setting overflow, and so s14ab exits with ifail=2 and returns xhuge. The value of xbig is given in the Library Constants section of the Introduction.

# Error Indicators and Warnings

Errors or warnings detected by the method:
ifail=1
ifail=2
On entry, x>xbig (see [Description]). On failure, the function value returned is the largest machine number (see x02al).