s19ad returns a value for the Kelvin function keix.

# Syntax

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

#### Parameters

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

#### Return Value

s19ad returns a value for the Kelvin function keix.

# Description

s19ad evaluates an approximation to the Kelvin function keix.
Note:  for x<0 the function is undefined, so we need only consider x0.
The method is based on several Chebyshev expansions:
For 0x1,
 kei⁡x=-π4ft+x24-gtlog⁡x+vt
where ft, gt and vt are expansions in the variable t=2x4-1;
For 1<x3,
 kei⁡x=exp-98x ut
where ut is an expansion in the variable t=x-2;
For x>3,
 kei⁡x=π 2x e-x/2 1+1x ctsin⁡β+1xdtcos⁡β
where β= x2+ π8 , and ct and dt are expansions in the variable t= 6x-1.
For x<0, the function is undefined, and hence the method fails and returns zero.
When x is sufficiently close to zero, the result is computed as
 kei⁡x=-π4+1-γ-logx2 x24
and when x is even closer to zero simply as
 kei⁡x=-π4.
For large x, keix is asymptotically given by π 2x e-x/2 and this becomes so small that it cannot be computed without underflow and the method fails.