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 relative errors in argument and result respectively, then in principle, , so the relative error in the argument is amplified in the result by at least a factor . The equality should hold if is greater than the machine precision ( due to data errors etc.), but if is simply a result of round-off in the machine representation, it is possible that an extra figure may be lost in internal calculation and round-off.
It should be noted that, for small , the amplification factor tends to zero and eventually the error in the result will be limited by machine precision.
For large , , the absolute error in the argument.
To guard against producing underflows, if is larger than a machine-dependent value , the result 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.