NAG Library Function Document
nag_cos_integral (s13acc) returns the value of the cosine integral .
||nag_cos_integral (double x,
nag_cos_integral (s13acc) evaluates
denotes Euler's constant.
The approximation is based on several Chebyshev expansions.
Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
x – doubleInput
On entry: the argument of the function.
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
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.
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.
The following program reads values of the argument from a file, evaluates the function at each value of and prints the results.
9.1 Program Text
Program Text (s13acce.c)
9.2 Program Data
Program Data (s13acce.d)
9.3 Program Results
Program Results (s13acce.r)