The approximation is based on several Chebyshev expansions.
4 References
Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
5 Arguments
1:
x – doubleInput
On entry: the argument of the function.
Constraint:
.
2:
fail – NagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).
6 Error Indicators and Warnings
NE_REAL_ARG_LE
On entry, x must not be less than or equal to 0.0: .
The function is not defined for this value and the result returned is zero.
7 Accuracy
If and are the absolute and relative errors in the result and is the relative error in the argument then in principle these are related by and . That is, accuracy will be limited by machine precision near the origin and near the zeros of , but near the zeros of only absolute accuracy can be maintained.
For large values of , therefore and since is limited by the finite precision of the machine it becomes impossible to return results which have any relative accuracy. That is, when we have that and hence is not significantly different from zero.
Hence, for , where is a machine-dependent value, in principle has values less than machine precision, and so is set directly to zero.
8 Further Comments
None.
9 Example
The following program reads values of the argument from a file, evaluates the function at each value of and prints the results.