s18cd returns a value of the scaled modified Bessel function ${e}^{x}{K}_{1}\left(x\right)$.

# Syntax

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

#### Parameters

x
Type: System..::..Double
On entry: the argument $x$ of the function.
Constraint: ${\mathbf{x}}>0.0$.
ifail
Type: System..::..Int32%
On exit: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

#### Return Value

s18cd returns a value of the scaled modified Bessel function ${e}^{x}{K}_{1}\left(x\right)$.

# Description

s18cd evaluates an approximation to ${e}^{x}{K}_{1}\left(x\right)$, where ${K}_{1}$ is a modified Bessel function of the second kind. The scaling factor ${e}^{x}$ removes most of the variation in ${K}_{1}\left(x\right)$.
The method uses the same Chebyshev expansions as s18ad, which returns the unscaled value of ${K}_{1}\left(x\right)$.

# References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications

# Error Indicators and Warnings

Errors or warnings detected by the method:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{x}}\le 0.0$: ${K}_{1}$ is undefined. On failure s18cd returns zero.
${\mathbf{ifail}}=2$
On entry, x is too close to zero, as determined by the value of the safe-range parameter x02am: there is a danger of causing overflow. On failure, s18cd returns the reciprocal of the safe-range parameter.
${\mathbf{ifail}}=-9000$
An error occured, see message report.

# Accuracy

Relative errors in the argument are attenuated when propagated into the function value. When the accuracy of the argument is essentially limited by the machine precision, the accuracy of the function value will be similarly limited by at most a small multiple of the machine precision.

None.

None.

# Example

This example reads values of the argument $x$ from a file, evaluates the function at each value of $x$ and prints the results.

Example program (C#): s18cde.cs

Example program data: s18cde.d

Example program results: s18cde.r