std::expint, std::expintf, std::expintl
来自cppreference.com
< cpp | experimental | special functions
double expint( double arg ); double expint( float arg ); |
(1) | |
double expint( IntegralType arg ); |
(2) | |
Template:cpp/experimental/special math/macro note
参数
arg | - | 浮点或整数类型的值 |
返回值
如果未发生错误,则返回 arg 的指数积分的值,即 -∫∞-arg
e-t |
t |
错误处理
根据 math_errhandling 的规定进行错误报告。
- 如果实参为 NaN,则返回 NaN 但不报告定义域错误。
- 如果实参为 ±0,则返回 -∞。
注解
不支持 TR 29124 但支持 TR 19768 的实现,在头文件 tr1/cmath
和命名空间 std::tr1
中提供此函数。
此函数的实现也在 boost.math 中可用。
示例
(以 gcc 6.0 运行)
运行此代码
#define __STDCPP_WANT_MATH_SPEC_FUNCS__ 1 #include <cmath> #include <iostream> int main() { std::cout << "Ei(0) = " << std::expint(0) << '\n' << "Ei(1) = " << std::expint(1) << '\n' << "Gompetz constant = " << -std::exp(1) * std::expint(-1) << '\n'; }
输出:
Ei(0) = -inf Ei(1) = 1.89512 Gompetz constant = 0.596347
外部链接
Weisstein, Eric W. "Exponential Integral." From MathWorld--A Wolfram Web Resource.