expm1
计算以e为底数的x次幂值,结果再减一。
接口定义
C interface:
float expm1f(float x);
double expm1(double x);
long double expm1l(long double x);
参数
参数名 |
类型 |
描述 |
输入/输出 |
---|---|---|---|
x |
|
表示输入数据的浮点值。 |
输入 |
返回值
- 返回以e为底x的指数函数值减1,y ∈ (-1, +INF)。
- 输入+0,返回+0。
- 输入-0,返回+0。
- expm1f输入大于0x1.62e42ep6(约88.72),返回+∞;expm1输入大于0x1.8p9(768),返回+∞。
- expm1f输入小于0x1.9fe368p6(约-103.97),返回-1.0;expm1输入小于-0x1.4cb5fp5(约-41.58),返回-1.0。
- 输入+∞,返回+∞。
- 输入-∞,返回-1.0。
- 输入nan,返回nan。
依赖
C: "km.h"
示例
C interface:
// typical usage double x1 = 0.0, x2 = -0.0; double a = 1.0, b = INFINITY, c = -INFINITY, d = NAN, e = 1024.0; // print result printf("expm1(0.0) = %.15f\n", expm1(x1)); printf("expm1(-0.0) = %.15f\n", expm1(x2)); printf("expm1(1024.0) = %.15f\n", expm1(e)); printf("expm1(1.0) = %.15f\n", expm1(a)); printf("expm1(INFINITY) = %.15f\n", expm1(b)); printf("expm1(-INFINITY) = %.15f\n", expm1(c)); printf("expm1(NAN) = %.15f\n", expm1(d)); /* * expm1(0.0) = 0.000000000000000 * expm1(-0.0) = -0.000000000000000 * expm1(1024.0) = inf * expm1(1.0) = 1.718281828459045 * expm1(INFINITY) = inf * expm1(-INFINITY) = -1.000000000000000 * expm1(NAN) = nan * * */
父主题: 指数和对数函数