﻿ g01ea Method
g01ea returns a one or two tail probability for the standard Normal distribution.

# Syntax

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

#### Parameters

tail
Type: System..::..String
On entry: indicates which tail the returned probability should represent.
${\mathbf{tail}}=\text{"L"}$
The lower tail probability is returned, i.e., $P\left(X\le x\right)$.
${\mathbf{tail}}=\text{"U"}$
The upper tail probability is returned, i.e., $P\left(X\ge x\right)$.
${\mathbf{tail}}=\text{"S"}$
The two tail (significance level) probability is returned, i.e., $P\left(X\ge \left|x\right|\right)+P\left(X\le -\left|x\right|\right)$.
${\mathbf{tail}}=\text{"C"}$
The two tail (confidence interval) probability is returned, i.e., $P\left(X\le \left|x\right|\right)-P\left(X\le -\left|x\right|\right)$.
Constraint: ${\mathbf{tail}}=\text{"L"}$, $\text{"U"}$, $\text{"S"}$ or $\text{"C"}$.
x
Type: System..::..Double
On entry: $x$, the value of the standard Normal variate.
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

g01ea returns a one or two tail probability for the standard Normal distribution.

# Description

The lower tail probability for the standard Normal distribution, $P\left(X\le x\right)$ is defined by:
 $PX≤x=∫-∞xZXdX,$
where
 $ZX=12πe-X2/2,-∞
The relationship
 $PX≤x=12erfc-x2$
is used, where erfc is the complementary error function, and is computed using s15ad. For the upper tail probability the relationship $P\left(X\ge x\right)=P\left(X\le -x\right)$ is used and for the two tail significance level probability twice the probability obtained from the absolute value of $x$ is returned.
When the two tail confidence probability is required the relationship
 $PX≤x-PX≤-x=erfx2,$
is used, where erf is the error function, and is computed using s15ae.

# References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Hastings N A J and Peacock J B (1975) Statistical Distributions Butterworth

# Error Indicators and Warnings

Errors or warnings detected by the method:
If ${\mathbf{ifail}}\ne {0}$, then g01ea returns $0.0$.
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{tail}}\ne \text{"L"}$, $\text{"U"}$, $\text{"S"}$ or $\text{"C"}$.
${\mathbf{ifail}}=-9000$
An error occured, see message report.

# Accuracy

Accuracy is limited by machine precision. For detailed error analysis see s15ad and s15ae.

None.

None.

# Example

Four values of tail and x are input and the probabilities calculated and printed.

Example program (C#): g01eae.cs

Example program data: g01eae.d

Example program results: g01eae.r