Synopsis
#include <boost/math/special_functions/expint.hpp>
namespace boost{ namespace math{ template <class T> calculated-result-type expint(unsigned n, T z); template <class T, class Policy> calculated-result-type expint(unsigned n, T z, const Policy&); }} // namespaces
The return type of these functions is computed using the result
type calculation rules: the return type is
The final Policy argument is optional and can be used to control the behaviour of the function: how it handles errors, what level of precision to use etc. Refer to the policy documentation for more details.
Descriptiontemplate <class T> calculated-result-type expint(unsigned n, T z); template <class T, class Policy> calculated-result-type expint(unsigned n, T z, const Policy&); Returns the exponential integral En of z:
AccuracyThe following table shows the peak errors (in units of epsilon) found on various platforms with various floating point types, along with comparisons to the Cephes library. Unless otherwise specified any floating point type that is narrower than the one shown will have effectively zero error. Table?45.?Errors In the Function expint(n, z)
TestingThe tests for these functions come in two parts: basic sanity checks use spot values calculated using Mathworld's online evaluator, while accuracy checks use high-precision test values calculated at 1000-bit precision with NTL::RR and this implementation. Note that the generic and type-specific versions of these functions use differing implementations internally, so this gives us reasonably independent test data. Using our test data to test other "known good" implementations also provides an additional sanity check. ImplementationThe generic version of this function uses the continued fraction:
for large x and the infinite series:
for small x.
Where the precision of x is known at compile time
and is 113 bits or fewer in precision, then rational approximations devised
by JM are used for the
For
and for
is used. |