acosd
计算输入实数的反余弦值对应的角度。
接口定义
C interface:
float acosdf(float x);
double acosd(double x);
long double acosdl(long double x);
参数
参数名 |
类型 |
描述 |
输入/输出 |
---|---|---|---|
x |
|
表示输入数据的浮点值。 |
输入 |
返回值
- 返回输入x的反余弦函数值对应的角度y=acos(x) * 180 / π,y ∈ [0, 180]。
- 输入+0,返回90。
- 输入-0,返回90。
- 输入x为1,返回+0。
- 输入x为-1,返回180。
- 输入|x|>1,返回nan。
- 输入±∞,返回nan。
- 输入nan,返回nan。
依赖
C: "km.h"
示例
C interface:
// typical usage float x1 = -1.0, x2 = 1.0, x3 = 0.5, x4 = -0.5; float a = 0.0, b = INFINITY, c = -INFINITY, d = NAN; // print result printf("acosdf(1.0) = %.15f\n", acosdf(x1)); printf("acosdf(-1.0) = %.15f\n", acosdf(x2)); printf("acosdf(0.5) = %.15f\n", acosdf(x3)); printf("acosdf(-0.5) = %.15f\n", acosdf(x4)); printf("acosdf(0.0) = %.15f\n", acosdf(a)); printf("acosdf(-0.0) = %.15f\n", acosdf(-a)); printf("acosdf(INFINITY) = %.15f\n", acosdf(b)); printf("acosdf(-INFINITY) = %.15f\n", acosdf(c)); printf("acosdf(NAN) = %.15f\n", acosdf(d)); /* * acosdf(1.0) = 180.000000000000000 * acosdf(-1.0) = 0.000000000000000 * acosdf(0.5) = 60.000000000000000 * acosdf(-0.5) = 120.000000000000000 * acosdf(0.0) = 90.000000000000000 * acosdf(-0.0) = 90.000000000000000 * acosdf(INFINITY) = nan * acosdf(-INFINITY) = nan * acosdf(NAN) = nan * * */
父主题: 三角函数