﻿s14ac Method
s14ac returns a value of the function ψx-lnx, where ψ is the psi function ψx= ddx lnΓx= Γx Γx .

# Syntax

C#
```public static double s14ac(
double x,
out int ifail
)```
Visual Basic (Declaration)
```Public Shared Function s14ac ( _
x As Double, _
<OutAttribute> ByRef ifail As Integer _
) As Double```
Visual C++
```public:
static double s14ac(
double x,
[OutAttribute] int% ifail
)```
F#
```static member s14ac :
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

s14ac returns a value of the function ψx-lnx, where ψ is the psi function ψx= ddx lnΓx= Γx Γx .

# Description

s14ac returns a value of the function ψx-lnx. The psi function is computed without the logarithmic term so that when x is large, sums or differences of psi functions may be computed without unnecessary loss of precision, by analytically combining the logarithmic terms. For example, the difference d=ψ x+12-ψx has an asymptotic behaviour for large x given by dlnx+12-lnx+O 1x2ln1+ 12x 12x .
Computing d directly would amount to subtracting two large numbers which are close to lnx+12  and lnx to produce a small number close to 12x , resulting in a loss of significant digits. However, using this method to compute fx=ψx-lnx, we can compute d=f x+12-fx+ln1+12x , and the dominant logarithmic term may be computed accurately from its power series when x is large. Thus we avoid the unnecessary loss of precision.
The method is derived from the method PSIFN in Amos (1983).

# Accuracy

All constants in s14ac are given to approximately 18 digits of precision. Calling the number of digits of precision in the floating-point arithmetic being used t, then clearly the maximum number of correct digits in the results obtained is limited by p=mint,18.
With the above proviso, results returned by this method should be accurate almost to full precision, except at points close to the zero of ψx, x1.461632, where only absolute rather than relative accuracy can be obtained.