tand
计算输入角度的正切值。
接口定义
C interface:
float tandf(float x);
double tand(double x);
long double tandl(long double x);
参数
参数名 |
类型 |
描述 |
输入/输出 |
---|---|---|---|
x |
|
表示角度的浮点值。 |
输入 |
返回值
- 正常区间:返回角度值x的正切值。
- 输入x = 180 * k,(k为整数),输出为±0。
- 输入x = 180 * k + 90,(k为整数),输出为±inf。
- 输入|x| = inf or nan,输出为nan。
依赖
C: "km.h"
示例
C interface:
// typical usage float x1 = -1.0, x2 = 1.0, x3 = 0.5, x4 = -0.5; // special handling float a = 0.0, b = INFINITY, c = -INFINITY, d = NAN; // print result printf("tand(1.0) = %.15f\n", tand(x1)); printf("tand(-1.0) = %.15f\n", tand(x2)); printf("tand(0.5) = %.15f\n", tand(x3)); printf("tand(-0.5) = %.15f\n", tand(x4)); printf("tand(0.0) = %.15f\n", tand(a)); printf("tand(-0.0) = %.15f\n", tand(-a)); printf("tand(INFINITY) = %.15f\n", tand(b)); printf("tand(-INFINITY) = %.15f\n", tand(c)); printf("tand(NAN) = %.15f\n", tand(d)); /* * tand(1.0) = -0.017455064928218 * tand(-1.0) = 0.017455064928218 * tand(0.5) = 0.008726867790759 * tand(-0.5) = -0.008726867790759 * tand(0.0) = 0.000000000000000 * tand(-0.0) = -0.000000000000000 * tand(INFINITY) = nan * tand(-INFINITY) = nan * tand(NAN) = nan * * */
父主题: 三角函数